schrodinger.ui.qt.appframework2.jobs module

Job runners are subclasses of task runners. See the tasks module for more general information.

class schrodinger.ui.qt.appframework2.jobs.RunMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.Enum

START = 1
WRITE = 2
STU = 3
class schrodinger.ui.qt.appframework2.jobs.JobOptions

Bases: object

A simple class for storing the options for a particular job runner. These options pertain to a runner, not to a specific job. For example, the host parameter only determines whether a host can be specified for this job type, not which host to use for any particular run.

__init__()
toDict()
class schrodinger.ui.qt.appframework2.jobs.JobConfig(job_options)

Bases: object

Holds the standard configuration settings for a particular job run. The job options determine what settings are available.

__init__(job_options)
Parameters

job_options (JobOptions) – the options for the associated job type.

applySettings(settings)
hostFlag()
dispFlag()
projFlag()
viewnameFlag()
appendFlags(cmdlist, run_mode=RunMode.START)

Takes a cmdlist and appends the standard configuration flags appropriate for the context. This will depend on whether the intent is to start or write the job and whether maestro is available.

Parameters
  • cmdlist (list) – the original command list

  • run_mode (RunMode) – which action is being taken - start, write, or STU

summaryText()

Generates the text to display in the status bar via the updateStatusText method.

class schrodinger.ui.qt.appframework2.jobs.JobWrapper(job, settings=None, name='', **kwargs)

Bases: schrodinger.ui.qt.appframework2.tasks.AbstractTaskWrapper

Wraps jobcontrol.Job objects to present a common interface for af2.tasks. See tasks.AbstractTaskWrapper for more information.

TASK_CLASS

alias of schrodinger.job.jobcontrol.Job

__init__(job, settings=None, name='', **kwargs)
Parameters
  • task (see derived class) – the underlying task object (depends on subclass)

  • name (str) – the task name

  • settings (dict) – the settings used to run this task

  • test_mode (bool) – disables type-checking of the task object. Used for mocking that task in tests

isRunning()

Whether this task is currently running.

status()

The current status of the task. The schema is flexible and can be agreed upon with the corresponding runner.

jobId()
class schrodinger.ui.qt.appframework2.jobs.WrittenJobWrapper(task, settings=None, name='', test_mode=False)

Bases: schrodinger.ui.qt.appframework2.tasks.AbstractTaskWrapper

This is basically an empty wrapper for representing a written job.

TASK_CLASS

alias of str

isRunning()

Whether this task is currently running.

status()

The current status of the task. The schema is flexible and can be agreed upon with the corresponding runner.

jobId()
filename()
class schrodinger.ui.qt.appframework2.jobs.BaseJobRunner(messaging_callback=None, settings_callback=None)

Bases: schrodinger.ui.qt.appframework2.tasks.AbstractTaskRunner

A job runner is a type of task runner that performs its task via launching a job under job control.

__init__(messaging_callback=None, settings_callback=None)

Initializes a new task runner

Parameters

messaging_callback

callback used for interacting with the user. This includes both reporting results or errors and asking questions to the user. The callback should be of the form:

f(message_type, text, options=None, runner=None)

where message_type is one of ERROR, WARNING, or QUESTION, text is the text of the message to be displayed, and options is an optional dict which can be used by the callback. For example, a dialog title could be passed to the callback via the options dict. The callback should never depend on the presence or absence of any options. The runner is simply the runner that is making the call, so that the callback can tell which runner is invoking the callback.

When the message is a question, the function should return the user’s response, typically True or False for a yes/no question.

Parameters

settings_callback

callback for communicating state with the parent object. This callback can be used both to push state to or pull state from the parent object. The callback should be of the form:

f(settings=None, runner=None)

If no settings are passed in, the callback should return the state of the parent object (i.e. the panel state) in the form of a dictionary.

The runner can be passed in as well if the callback needs to access the runner to properly process the callback.

If a settings dictionary is passed in, the callback should apply any settings in the dictionary to the parent object (thus altering its state). Passing in an empty dictionary is a no-op.

start()

Starts the task. This includes the preliminary work of calling preValidate() and running validation before attempting to actually start the task itself.

The actual starting of the task should be handled in the _start method in the derived classes and will vary depening on the type of runner.

postProcess(task)

Download job outputs after the job completes.

resetState()
validateJobName()
addTask(task)

Add a new task to be tracked. This should be called whenever a task is started.

Parameters

task (AbstractTaskWrapper) – the task

findJob(jobid)

Finds a wrapped job by its job id.

Parameters

jobid (str) – the job id

Returns

the job

Return type

JobWrapper

viewname()
update()

Slot method to update the state of the job runner.

write()

Call this to write out a job to be run later.

getSHFilename()

Returns the .sh filename for the next job.

writeSTU()

Writes out a STU test set.

createJobDir()
nextJobDir()
makeSchrodingerCmd(*args)

Builds a $SCHRODINGER command string from all the args passed in. The resulting string is suitable for use in a cmdlist and formatted for use in starting or writing the job depending on self.run_mode. In START mode, the $SCHRODINGER environment variable will be expanded. In WRITE mode, it will stay as $SCHRODINGER and the path will be delimited with linux-style forward slashes.

Example: self.makeSchrodingerCmd(‘utilities’, ‘my_utility’) will return “${SCHRODINGER}/utilities/my_utility” in WRITE mode.

getSchrodingerRun()

Returns the correct version of the $SCHRODINGER/run string. This will depend on whether the intent is to start or to write the job.

makeCmdList()

Implement this to generate a cmdlist. This cmdlist will be used for write functionality.

setupJobOptions(options)

Override this to set the job options for this job. The options is passed in by the framework. Modify and return the options object. The options object will determine, for example, what the config dialog should look like. For example:

options.incorporation = False
options.create_job_dir = False
return options

If this method is not overridden, default options will be used.

Parameters

options (JobOptions) – the options object to be customized.

jobOptions()
setConfig(config)
getNextConfig()
appendConfigFlags(cmdlist)
setCustomName(name)

Sets a custom name for the next task to be run.

Parameters

name (str) – the custom name. Pass in an empty string to return to standard naming.

updateStatusText()

Override this to update the status, for example, when settings have changed or the current task runner is switched.

class schrodinger.ui.qt.appframework2.jobs.CmdJobRunner(messaging_callback=None, settings_callback=None)

Bases: schrodinger.ui.qt.appframework2.jobs.BaseJobRunner

This is the basic job runner for setting up and running a cmd line job. The job is launched using jobcontrol.launch_job().

makeCmdList()

This is the main method that needs to be implemented to define a specific cmd job runner. It should just return a complete cmd list for the job to be launched. Standard job options should be left off.

schrodinger.ui.qt.appframework2.jobs.cmdlist_to_cmd(cmdlist)

Converts a command list to a command string. Don’t do this if you can possibly avoid it.

Parameters

cmdlist (list) – a list of commands

Returns

str

schrodinger.ui.qt.appframework2.jobs.set_sh_file_flags(filename)
schrodinger.ui.qt.appframework2.jobs.get_first_hostname(host)

Given a host string, get the corresponding hosts list from jobcontrol and return the first hostname from that list.

Parameters

host (string) –

Hosts string which determine the string value of result server argument. These are values usually from configuration dialog and is of the form “galina” or “galina:1” or “galina,monica” or “galina:2,monica:3” or “galina monica” or “galina:2 monica:3”.

rtype

str

return

Hostname based on the first of the first hosts in the jobcontrol list.

schrodinger.ui.qt.appframework2.jobs.job_belongs_to_panel(jobid, viewname)

Return True if jobid belongs to viewname of a panel. Used by incorporation callbacks to determine if the job belongs to us.

Parameters
  • jobid (str) – jobid for a given job

  • viewname (str) – viewname corresponding to panel