Changeset 1613 for palm/trunk/SCRIPTS/palm_wd
- Timestamp:
- Jul 8, 2015 2:53:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palm_wd
r1612 r1613 20 20 # Current revisions: 21 21 # ----------------- 22 # 22 # Bugfix: tooltip for queuing name did not show up on first update. 23 # New: added contect menu for showing the parameter file and the run control 24 # output 23 25 # 24 26 # Former revisions: … … 87 89 job_data_list = [] 88 90 91 class MessageBoxScroll(QtGui.QMessageBox): 92 def __init__(self): 93 QtGui.QMessageBox.__init__(self) 94 self.setSizeGripEnabled(True) 95 96 def event(self, e): 97 result = QtGui.QMessageBox.event(self, e) 98 99 self.setMinimumHeight(100) 100 self.setMaximumHeight(16777215) 101 self.setMinimumWidth(400) 102 self.setMaximumWidth(16777215) 103 self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) 104 105 textEdit = self.findChild(QtGui.QTextEdit) 106 if textEdit != None : 107 textEdit.setMinimumHeight(800) 108 textEdit.setMaximumHeight(16777215) 109 textEdit.setMinimumWidth(1000) 110 textEdit.setMaximumWidth(16777215) 111 textEdit.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) 112 f = QtGui.QFont('not_a_font') # 113 f.setStyleHint(f.TypeWriter, f.PreferDefault) 114 textEdit.setFont(f) 115 116 return result 117 118 89 119 # MainWindow class 90 120 class Watchdog(QtGui.QMainWindow): … … 112 142 self.table.setColumnHidden(6, True) 113 143 self.table.setRowCount(0) 114 144 115 145 # Display MainWindow 116 146 self.show() … … 145 175 146 176 # "Show details" -> fetch details for the selected job 147 detailsjobAction = menu.addAction('Show details')177 detailsjobAction = menu.addAction('Show job details') 148 178 detailsjobAction.setStatusTip('Display detailed info for job') 149 179 detailsjobAction.triggered.connect(self.ShowDetails) 150 180 181 # "Show parameter file" -> show the contents of PARIN 182 parinAction = menu.addAction('Show parameter file') 183 parinAction.setStatusTip('Display the parameter file of the job (e.g. PARIN / _p3d)') 184 parinAction.triggered.connect(self.ShowPARIN) 185 186 rcAction = menu.addAction('Show run control file') 187 rcAction.setStatusTip('Display the current run control file (e.g. RUN_CONTROL / _rc)') 188 rcAction.triggered.connect(self.ShowRC) 189 151 190 # "Cancel job" -> remove job from queuing system 152 191 canceljobAction = menu.addAction('Cancel job') … … 154 193 canceljobAction.triggered.connect(self.CancelJob) 155 194 156 # "Force stop" -> remove job from queuing system195 # "Force stop" -> force termination of job 157 196 stopjobAction = menu.addAction('Force stop') 158 197 stopjobAction.setStatusTip('Terminate job properly') 159 198 stopjobAction.triggered.connect(self.DoStop) 160 199 161 # "Force restart" -> remove job from queuing system200 # "Force restart" -> force rermination and restart of job 162 201 restartjobAction = menu.addAction('Force restart') 163 202 restartjobAction.setStatusTip('Terminate job properly and initiate restart') … … 184 223 stopjobAction.setEnabled(True) 185 224 restartjobAction.setEnabled(True) 225 parinAction.setEnabled(True) 226 rcAction.setEnabled(True) 186 227 else: 187 228 stopjobAction.setEnabled(False) 188 229 restartjobAction.setEnabled(False) 189 230 parinAction.setEnabled(False) 231 rcAction.setEnabled(False) 232 190 233 # Show the context menu 191 234 action = menu.exec_(self.table.mapToGlobal(position)) … … 373 416 item.setToolTip("Queuing name: " + job_data[to_display[j]][6]) 374 417 self.table.setItem(i, 0, item) 375 self.table.setItem(i, 0, QtGui.QTableWidgetItem(job_data[to_display[j]][0]))376 418 self.table.setItem(i, 1, QtGui.QTableWidgetItem(job_data[to_display[j]][1])) 377 419 self.table.setItem(i, 2, QtGui.QTableWidgetItem(job_data[to_display[j]][2])) … … 607 649 notify = QtGui.QMessageBox.information(self,'Terminate job for restart',"Restart for job" + jobname + " was initiated!\n\nServer message:\n" + ''.join(result)) 608 650 651 652 # Read the PARIN file of the job 653 def ShowPARIN(self): 654 655 # Return internal jobname 656 jobname = self.table.item(self.table.currentRow(),6).text() 657 jobrealname = self.table.item(self.table.currentRow(),0).text() 658 659 # Check description of job in order to login on the correct host 660 descr = self.table.item(self.table.currentRow(),1).text() 661 for h in range(0,len(description)): 662 if ( descr == description[h] ): 663 host = username[h] + "@" + hostname[h] 664 user = username[h] 665 666 ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd parin " + user + " " + jobname], 667 shell=False, 668 stdout=sub.PIPE, 669 stderr=sub.PIPE) 670 result = ssh.stdout.readlines() 671 result = filter(None, result) 672 673 # In case of error display a warning message 674 if ( len(result) == 0 ): 675 error = ssh.stderr.readlines() 676 notify = QtGui.QMessageBox.warning(self,'Showing parameter file',"Error. Could not fetch parameter file for job " + jobrealname + " (" + jobname + ").\n\nError message:\n" + ''.join(error)) 677 678 # Otherwise inform the user and mark the job in the table 679 else: 680 mb = MessageBoxScroll() 681 mb.setText("Parameter file for job: " + jobrealname + "") 682 mb.setDetailedText(''.join(result)) 683 mb.exec_() 684 685 # Read the PARIN file of the job 686 def ShowRC(self): 687 688 # Return internal jobname and real job name 689 jobname = self.table.item(self.table.currentRow(),6).text() 690 jobrealname = self.table.item(self.table.currentRow(),0).text() 691 692 # Check description of job in order to login on the correct host 693 descr = self.table.item(self.table.currentRow(),1).text() 694 for h in range(0,len(description)): 695 if ( descr == description[h] ): 696 host = username[h] + "@" + hostname[h] 697 user = username[h] 698 699 ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd rc " + user + " " + jobname], 700 shell=False, 701 stdout=sub.PIPE, 702 stderr=sub.PIPE) 703 result = ssh.stdout.readlines() 704 result = filter(None, result) 705 706 # In case of error display a warning message 707 if ( len(result) == 0 ): 708 error = ssh.stderr.readlines() 709 notify = QtGui.QMessageBox.warning(self,'Showing run control',"Error. Could not fetch run control file for job " + jobrealname + "(" + jobname + ").\n\nError message:\n" + ''.join(error)) 710 711 # Otherwise inform the user and mark the job in the table 712 else: 713 mb = MessageBoxScroll() 714 lastline = result[len(result)-2].split()[2] 715 mb.setText("Simulated time for job " + jobrealname + " is currently: " + lastline) 716 mb.setDetailedText(''.join(result)) 717 mb.exec_() 609 718 610 719 # Remove a job from list - removes the current row from the table and from
Note: See TracChangeset
for help on using the changeset viewer.