Package schrodinger :: Package ui :: Package qt :: Package appframework2 :: Module af2 :: Class JobApp
[hide private]
[frames] | no frames]

Class JobApp

                           object --+        
                                    |        
maestro_callback.MaestroCallbackMixin --+    
                                        |    
                           object --+   |    
                                    |   |    
                  markers.MarkerMixin --+    
                                        |    
                           object --+   |    
                                    |   |    
               settings.SettingsMixin --+    
                                        |    
               baseapp.ValidatedPanel --+    
                                        |    
                                      App --+
                                            |
                                           JobApp

Instance Methods [hide private]
 
__init__(self, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
 
setPanelOptions(self)
Configure the panel by setting instance variables here.
 
getConfigDialog(self)
 
setup(self)
 
setDefaults(self)
 
layOut(self)
 
createBottomBar(self)
 
syncConfigDialog(self)
 
configDialogSettings(self)
 
setConfigDialogSettings(self, new_values)
 
_settings(self)
False or None
_start(self)
Returns: Returns False upon failure, otherwise returns nothing (None)
False or None
_write(self)
Returns: Returns False upon failure, otherwise returns nothing (None)
False or None
_startOrWrite(self)
Combined method for starting a job or writing it to a .sh file.
 
jobnameData(self)
Provides panel settings that are to be incorporated into job names.
 
jobnameDataChanged(self)
If the job name includes panel settings, then this method should be called whenever the relevant panel settings are modified
 
updateJobname(self, uniquify_custom=True)
Generate a new job name based on the current panel settings
tuple
_getStandardJobnames(self)
Get the old and new standard job names
basestring
sanitizeJobnameText(self, text)
Modify the given text so it can be used in a job name.
 
_populateEmptyJobname(self)
If the user clears the job name line edit, populate it with the standard job name
 
runMaestro(self)
 
closeEvent(self, event)
Receives the close event and calls the panel's 'close'-decorated appmethod.
 
cleanup(self)
 
_getSHFilename(self, jobdir=None)
 
jobname(self)
 
setJobname(self, jobname)
 
writeJobCmd(self, cmdlist)
Writes the job invocation command to a file named "<jobname>.sh" Removes options from the command that are maestro-specific.
 
cleanupWriteCmd(self, cmdlist)
Removes options from the command that only work within Maestro.
 
cmdListToCmd(self, cmdlist)
Converts a command list to a command string.
 
getCmdListArgValue(self, cmdlist, arg)
 
jobDir(self)
 
createJobDir(self)
 
registerJob(self, job, show_progress_bar=NO_PROGRESS_BAR)
Registers a job with the periodic job check callback and starts timer.
 
_periodicJobCheck(self)
This is called every 3 seconds when a job is running, and is used to emit a signal when that job finishes.
 
updateStatusBar(self)
Updates the status bar.
str
generateStatus(self)
Generate the text to put into the status bar
 
launchScript(self, script, script_args=None, input_files=[], structure_output_file=None, output_files=[], localdriver=False, aux_modules=[], show_progress_bar=NO_PROGRESS_BAR, **kwargs)
Creates and launches a script using makeLauncher.
 
launcherToCmdList(self, slauncher)
Launcher
makeLauncher(self, script, script_args=[], input_files=[], structure_output_file=None, output_files=[], localdriver=False, aux_modules=[], **kwargs)
Create a launcher.Launcher instance using the settings defined by the panel, its config dialog, and specified arguments.
 
launchLauncher(self, slauncher, show_progress_bar=NO_PROGRESS_BAR)
Either launches a launcher instance or writes the job invocation command, depending on the state of self.start_mode.
 
launchJobCmd(self, cmdlist, show_progress_bar=NO_PROGRESS_BAR, auto_add_host=True)
Launches a job control command.
 
setupJobCmd(self, cmdlist, auto_add_host=True)
Adds standard arguments HOST, NJOBS, PROJ, DISP, VIEWNAME to the cmdlist if they are set in the config dialog.
 
_addCmdParam(self, cmdlist, cd_params, cdname, cmdname=None)
 
_getSTUZIPFilename(self, jobname)
 
_makeLocaleIndependent(self, jobdir, remove_host=True)
This takes a job written for a specific machine / Schrodinger installation, and makes it compatible wherever it's run.
 
showSTUDialog(self, sh_txt, jobname)
Shows dialog with information necessary to start a STU test, including a label that links to the test suite.
False or None
_writeSTU(self)
This function writes the jobdir using normal af2 methods, then processes the .sh file and jobdir into a zip, so that it can be easily used by STU.

Inherited from App: createInputSelector, defineCustomSettings, getAliasedValue, getPanelState, getWorkspaceStructure, loadPanelState, setAliasedValue, setPanelState, showEvent, showProgressBarForJob, writePanelState

Inherited from App (private): _close, _configurePanelSettings, _help, _read, _reset, _statusShrunk, _updateProgressBar

Inherited from maestro_callback.MaestroCallbackMixin: buildCallbackDicts

Inherited from maestro_callback.MaestroCallbackMixin (private): _addCallbacks, _delayedCallbacks, _removeCallbacks

Inherited from markers.MarkerMixin: addMarker, getAllMarkers, getMarker, hideAllMarkers, removeAllMarkers, removeAllMarkersForEntry, removeMarker, removeMarkerForAtoms, showAllMarkers

Inherited from markers.MarkerMixin (private): _calcEntryAtomTotal, _canonicalizeAtomOrder, _clearInvalidatedMarkers, _createMarker, _eidsFromHashable, _genMarkerHash, _updateMarkers

Inherited from settings.SettingsMixin: __getitem__, __setitem__, applySettings, getAliasedSettings, getObjValue, getSettings, setAlias, setAliases, setObjValue

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]

Inherited from App: panel

Class Variables [hide private]
  lastJobCompleted = QtCore.pyqtSignal()

Inherited from App (private): _singleton

Instance Variables [hide private]

Inherited from markers.MarkerMixin: MARKER_ICONS

Inherited from markers.MarkerMixin (private): _marked_eid_lengths, _markers

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

setPanelOptions(self)

 

Configure the panel by setting instance variables here. Always call the
parent method. Panel options:

self.maestro_dockable - whether this panel should be dockable in the
    Maestro main window. Setting to true will automatically dock the
    panel on the right-hand side of the main window. Default False.

self.title - string to display in the window title bar

self.ui - a Ui_Form instance defining the main ui, default None

self.allowed_run_modes - subset of [MODE_MAESTRO, MODE_STANDALONE,
    MODE_SUBPANEL, MODE_CANVAS] defining how the panel may be run.
    Default is all.

self.help_topic - string defining the help topic. Default ''

self.help_product - string defining help product. Default 'maestro'

self.input_selector_options - dict of options for the common input
    selector widget. Default is an empty dict, meaning do not add an
    input selector

self.add_main_layout_stretch - bool of whether to add a stretch to the
    main layout under the main ui (if self.ui exists). Default is True

Overrides: App.setPanelOptions
(inherited documentation)

setup(self)

 
Overrides: App.setup

layOut(self)

 
Overrides: App.layOut

createBottomBar(self)

 
Overrides: App.createBottomBar

_start(self)

 
Returns: False or None
Returns False upon failure, otherwise returns nothing (None)
Overrides: App._start

_write(self)

 
Returns: False or None
Returns False upon failure, otherwise returns nothing (None)

_startOrWrite(self)

 

Combined method for starting a job or writing it to a .sh file. The value of self.start_mode determines which to do.

Returns: False or None
Returns False upon failure, otherwise returns nothing (None)

jobnameData(self)

 

Provides panel settings that are to be incorporated into job names. If self.default_jobname includes string formatting characters (i.e. %s, {0}, etc.), then this method must be implemented. It should return a tuple or a dictionary to be interpolated into the job name.

updateJobname(self, uniquify_custom=True)

 

Generate a new job name based on the current panel settings

Parameters:
  • uniquify_custom (bool) - Whether we should uniquify custom job name by adding integers to the end. If False, only standard and modified job names will be uniquified. (See JobnameType for an explanation of job name types.)

_getStandardJobnames(self)

 

Get the old and new standard job names

Returns: tuple
A tuple of:
  • The standard job name using the panel settings from the last time we ran this method. (Needed to search for the standard job name in the current job name.)
  • The standard job name using the current panel settings. (Needed to generate the new job name.)

sanitizeJobnameText(self, text)

 

Modify the given text so it can be used in a job name. White space is replaced with underscores and all other disallowed characters are removed.

Parameters:
  • text (basestring) - The text to sanitize
Returns: basestring
The sanitized text

closeEvent(self, event)

 

Receives the close event and calls the panel's 'close'-decorated appmethod. If the appmethod specifically returns False, the close event will be ignored and the panel will remain open. All other return values (including None) will allow the panel to proceed with closing.

This is a PyQT slot method and should not be explicitly called.

Overrides: markers.MarkerMixin.closeEvent
(inherited documentation)

cleanup(self)

 
Overrides: App.cleanup

writeJobCmd(self, cmdlist)

 

Writes the job invocation command to a file named "<jobname>.sh" Removes options from the command that are maestro-specific.

Parameters:
  • cmdlist (list) - the job invocation command

cleanupWriteCmd(self, cmdlist)

 

Removes options from the command that only work within Maestro.

Parameters:
  • cmdlist (list) - the job invocation command

cmdListToCmd(self, cmdlist)

 

Converts a command list to a command string.

Parameters:
  • cmdlist (list) - a list of commands
Returns:
a command string with all arguments wrapped in double quotes

registerJob(self, job, show_progress_bar=NO_PROGRESS_BAR)

 

Registers a job with the periodic job check callback and starts timer.

Parameters:
  • job (jobcontrol.Job) - job to register
  • show_progress_bar (int) - Whether or not to show a progress bar tracking the job's status. If NO_PROGRESS_BAR, no progress bar will be shown. If PROGRESS_BAR_NO_TEXT, a progress bar will be shown. If PROGRESS_BAR_WITH_TEXT, a progress bar will be shown and will also display the job progress text description.

_periodicJobCheck(self)

 

This is called every 3 seconds when a job is running, and is used to emit a signal when that job finishes.

Checking a specific job (as opposed to querying the entire DB) is a very fast operation, so it can be done frequently.

generateStatus(self)

 

Generate the text to put into the status bar

Returns: str
The text to put into the status bar

launchScript(self, script, script_args=None, input_files=[], structure_output_file=None, output_files=[], localdriver=False, aux_modules=[], show_progress_bar=NO_PROGRESS_BAR, **kwargs)

 

Creates and launches a script using makeLauncher. For documentation on method parameters, see makeLauncher below. Use this method for scripts that do not themselves integrate with job control.

This method honors self.start_mode; it can either launch the script or write out a job file to the job directory.

Parameters:
  • show_progress_bar (int) - Whether or not to show a progress bar tracking the job's status. If NO_PROGRESS_BAR, no progress bar will be shown. If PROGRESS_BAR_NO_TEXT, a progress bar will be shown. If PROGRESS_BAR_WITH_TEXT, a progress bar will be shown and will also display the job progress text description.

makeLauncher(self, script, script_args=[], input_files=[], structure_output_file=None, output_files=[], localdriver=False, aux_modules=[], **kwargs)

 

Create a launcher.Launcher instance using the settings defined by the panel, its config dialog, and specified arguments. Returns a launcher instance ready to be launched or further modified. Use this method for scripts that do not themselves integrate with job control.

Only use this method if you need to modify the launcher before launching it. Otherwise, the method launchScript() is preferred to create the launcher and launch it.

Parameters:
  • script (str) - Remote path to the script to be launched. See Launcher documentation for more info. If only launching to localhost is desired, then a local path can be specified.
  • script_args (list of str) - arguments to be added to the script's command line
  • input_files (list of str) - input files that will be copied to the temporary job directory.
  • structure_output_file (str) - this is the file that will be registered with job control to incorporate at the end of the job
  • output_files (list of str) - additional output files to be copied back from the temporary job directory
  • localdriver (bool) - run the script locally and pass it the HOST option. Set this to True if your script is launching other jobs and you want only the subjobs to be sent to the host specified in the config dialog.
  • aux_modules (list of modules) - Additional modules required by the script
Returns: Launcher
A prepped launcher

launchLauncher(self, slauncher, show_progress_bar=NO_PROGRESS_BAR)

 

Either launches a launcher instance or writes the job invocation command, depending on the state of self.start_mode. This allows the panel's start method to double as a write method.

Calling launchLauncher() is only necessary if creating a customized launcher using makeLauncher().

Parameters:
  • show_progress_bar (int) - Whether or not to show a progress bar tracking the job's status. If NO_PROGRESS_BAR, no progress bar will be shown. If PROGRESS_BAR_NO_TEXT, a progress bar will be shown. If PROGRESS_BAR_WITH_TEXT, a progress bar will be shown and will also display the job progress text description.

launchJobCmd(self, cmdlist, show_progress_bar=NO_PROGRESS_BAR, auto_add_host=True)

 

Launches a job control command. Use this to launch scripts that accept the standard job control options arguments like -HOST, -DISP, etc. By default, automatically populates standard arguments from the config dialog, but will not overwrite if they are already found in cmdlist. For example, if -HOST is found in cmdlist, launchJobCmd will ignore the host specified in the config dialog.

This method honors self.start_mode; it can either launch the script or write out a job file to the job directory.

Parameters:
  • cmdlist (list) - the command list
  • show_progress_bar (int) - Whether or not to show a progress bar tracking the job's status. If NO_PROGRESS_BAR, no progress bar will be shown. If PROGRESS_BAR_NO_TEXT, a progress bar will be shown. If PROGRESS_BAR_WITH_TEXT, a progress bar will be shown and will also display the job progress text description.
  • auto_add_host (bool) - Whether or not to automatically add -HOST flag to command when it is not already included.

setupJobCmd(self, cmdlist, auto_add_host=True)

 

Adds standard arguments HOST, NJOBS, PROJ, DISP, VIEWNAME to the cmdlist if they are set in the config dialog. Settings pre-existing in the cmdlist take precedence over the config dialog settings.

Parameters:
  • cmdlist (list) - the command list
  • auto_add_host (bool) - Whether or not to automatically add -HOST flat to command when it is not already included.

_makeLocaleIndependent(self, jobdir, remove_host=True)

 

This takes a job written for a specific machine / Schrodinger
installation, and makes it compatible wherever it's run.  This is
necessary for STU.  To do this it must:
1)  Copy input files outside of $SCHRODINGER and jobdir into the jobdir
2)  Change specific references to the current SCHRODINGER to the env
    variable ${SCHRODINGER}

@param remove_host: Whether to remove the -HOST argument or not,
must be set to True for STU.
@type  remove_host: bool

@return: Text from the .sh file, made locale independent
@rtype:  str

showSTUDialog(self, sh_txt, jobname)

 

Shows dialog with information necessary to start a STU test, including a label that links to the test suite.

Parameters:
  • sh_txt (str) - Text contained within the .sh file

_writeSTU(self)

 

This function writes the jobdir using normal af2 methods, then processes the .sh file and jobdir into a zip, so that it can be easily used by STU.

Returns: False or None
Returns False upon failure, otherwise returns nothing (None)