schrodinger.tasks.jobtasks module

class schrodinger.tasks.jobtasks.RunMode

Bases: enum.Enum

An enumeration.

START = 1
STU = 3
WRITE = 2
class schrodinger.tasks.jobtasks.JobOptions(default_value=None, **kwargs)

Bases: schrodinger.models.parameters.CompoundParam

incorporation
default_disp
host
cpus
create_job_dir
cpusChanged
create_job_dirChanged
default_dispChanged
hostChanged
incorporationChanged
class schrodinger.tasks.jobtasks.JobConfig(*args, **kwargs)

Bases: schrodinger.models.parameters.CompoundParam

job_options
disp
host
cpus
viewname
jobname
host_text
proj
addHostFlag(cmdlist)
addResultServerFlag(cmdlist)
addDispFlag(cmdlist)
addProjFlag(cmdlist)
addViewnameFlag(cmdlist)
addTmpLaunchDirFlag(cmdlist)
appendFlags(cmdlist)

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.

Any flag that already exists in the cmdlist will take precedence and that flag will not be automatically appended.

Parameters:cmdlist (list) – the original command list.
applySettings(settings)
summaryText()

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

cpusChanged
dispChanged
hostChanged
host_textChanged
job_optionsChanged
jobnameChanged
projChanged
viewnameChanged
class schrodinger.tasks.jobtasks.AbstractJobTask(*args, **kwargs)

Bases: schrodinger.tasks.tasks.AbstractTask

job_options
job_config
job_dir
start()

Start this task. This includes any preprocessing and validation checks. Any failures will prevent the task from running.

write()
getWriteFilename()
isRunning()
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.

fullCmdList()

Returns the full cmd list for the job. This will take into account the run_mode specified in the job_config.

makeCmdList()

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

appendConfigFlags(cmdlist)
updateStatusText()
job_configChanged
job_dirChanged
job_optionsChanged
class schrodinger.tasks.jobtasks.CmdJobTask(*args, **kwargs)

Bases: schrodinger.tasks.jobtasks.AbstractJobTask

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.tasks.jobtasks.get_job_status_loop()
schrodinger.tasks.jobtasks.monitor_jobtask(jobtask)
class schrodinger.tasks.jobtasks.JobStatusLoop

Bases: PyQt5.QtCore.QObject

monitorJobTask(jobtask)
updateNow()
schrodinger.tasks.jobtasks.get_project_name()
schrodinger.tasks.jobtasks.use_detached_jobs(host)

Returns boolean if we should use detached jobs.

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”. And based on ‘serverhost’ field of the first host, return boolean if we should use detached jobs.
schrodinger.tasks.jobtasks.make_schrodinger_cmd(cmdlist, mode=<RunMode.START: 1>)
schrodinger.tasks.jobtasks.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.tasks.jobtasks.result_server_option(host)

Return string value of result server argument.

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”. And based on ‘serverhost’ field of the first host, the result server argument is returned.
schrodinger.tasks.jobtasks.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
schrodinger.tasks.jobtasks.cmdlist_to_cmd(cmdlist)

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

subprocess.list2cmdline() is not sufficient because it won’t quote env vars like $SCHRODINGER (which can expand to “path with spaces”

Parameters:cmdlist (list) – a list of commands
Returns:sh interpolable list
schrodinger.tasks.jobtasks.set_sh_file_flags(filename)