Ignore:
Timestamp:
Jul 8, 2015 2:53:29 PM (9 years ago)
Author:
maronga
Message:

bugfix in install_rrtmg, removed nc2vdf from mbuild, improved palm_wd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_wd

    r1612 r1613  
    2020# Current revisions:
    2121# -----------------
    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
    2325#
    2426# Former revisions:
     
    8789job_data_list = []
    8890
     91class 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
    89119# MainWindow class
    90120class Watchdog(QtGui.QMainWindow):
     
    112142        self.table.setColumnHidden(6, True)
    113143        self.table.setRowCount(0)
    114        
     144   
    115145        # Display MainWindow
    116146        self.show()
     
    145175       
    146176        # "Show details" -> fetch details for the selected job
    147         detailsjobAction = menu.addAction('Show details')     
     177        detailsjobAction = menu.addAction('Show job details')     
    148178        detailsjobAction.setStatusTip('Display detailed info for job')
    149179        detailsjobAction.triggered.connect(self.ShowDetails)
    150180
     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       
    151190        # "Cancel job" -> remove job from queuing system
    152191        canceljobAction = menu.addAction('Cancel job')
     
    154193        canceljobAction.triggered.connect(self.CancelJob)
    155194       
    156         # "Force stop" -> remove job from queuing system
     195        # "Force stop" -> force termination of job
    157196        stopjobAction = menu.addAction('Force stop')
    158197        stopjobAction.setStatusTip('Terminate job properly')
    159198        stopjobAction.triggered.connect(self.DoStop)
    160199   
    161         # "Force restart" -> remove job from queuing system
     200        # "Force restart" -> force rermination and restart of job
    162201        restartjobAction = menu.addAction('Force restart')
    163202        restartjobAction.setStatusTip('Terminate job properly and initiate restart')
     
    184223            stopjobAction.setEnabled(True)
    185224            restartjobAction.setEnabled(True)   
     225            parinAction.setEnabled(True)
     226            rcAction.setEnabled(True)         
    186227        else:
    187228            stopjobAction.setEnabled(False)
    188229            restartjobAction.setEnabled(False)   
    189    
     230            parinAction.setEnabled(False)
     231            rcAction.setEnabled(False) 
     232           
    190233        # Show the context menu
    191234        action = menu.exec_(self.table.mapToGlobal(position))
     
    373416                item.setToolTip("Queuing name: " + job_data[to_display[j]][6])
    374417                self.table.setItem(i, 0, item)   
    375                 self.table.setItem(i, 0, QtGui.QTableWidgetItem(job_data[to_display[j]][0]))           
    376418                self.table.setItem(i, 1, QtGui.QTableWidgetItem(job_data[to_display[j]][1]))
    377419                self.table.setItem(i, 2, QtGui.QTableWidgetItem(job_data[to_display[j]][2]))   
     
    607649            notify = QtGui.QMessageBox.information(self,'Terminate job for restart',"Restart for job" + jobname + " was initiated!\n\nServer message:\n" + ''.join(result))
    608650           
     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_()
    609718
    610719    # Remove a job from list - removes the current row from the table and from
Note: See TracChangeset for help on using the changeset viewer.