schrodinger.tasks.jobtasks module¶
Job incorporation¶
If a CmdJobTask’s job registers an incorporation file with job control, the file can be accessed after the task is done via output.incorporation_file.
ComboJobTasks support the option to specify an incorporation file in the backend of the task using JobOutput. Example:
class MyJobTask(jobtasks.ComboJobTask):
output: jobtasks.JobOutput
def mainFunction(self):
self.output.incorporation_file = 'foo.maegz' # In backend
Specifying an incorporation file in the frontend of the task will have no effect and thus should never be done.
- schrodinger.tasks.jobtasks.is_jobtask(task)¶
Utility function to check if an object is a jobtask.
- class schrodinger.tasks.jobtasks.AllowedHostTypes¶
Bases:
schrodinger.models.jsonable.JsonableEnum
- CPU_ONLY = 1¶
- GPU_ONLY = 2¶
- CPU_AND_GPU = 3¶
- class schrodinger.tasks.jobtasks.HostParam(*args, _param_type=<object object>, **kwargs)¶
Bases:
schrodinger.models.parameters.Param
- DataClass¶
alias of
schrodinger.tasks.hosts.Host
- __init__(default_value='localhost', allowed_types=AllowedHostTypes.CPU_ONLY, *args, **kwargs)¶
- Parameters
default_value (object) – The value to use in constructing the default value for the param. A new param will have the value returned by
DataClass(default_value)
.DataClass (type) – The type to use for values of this param.
deepcopyable (bool) – Whether values of this param are deepcopyable. If this param is not deepcopyable and its owner param is deepcopied, the copy’s subparam value will be identical.
_param_type – For internal use only.
- schrodinger.tasks.jobtasks.get_hosts()¶
- schrodinger.tasks.jobtasks.get_default_host(allowed_host_types=AllowedHostTypes.CPU_AND_GPU)¶
Gets the default host for a job to run on, which will be the jobhost if this function is called from within a jobcontrol backend, or the localhost otherwise. If the specified host type is GPU_ONLY, and the localhost and jobhost don’t have GPUs, then the returned host will be the first gpu-enabled host returned from
get_hosts()
.
- class schrodinger.tasks.jobtasks.HostSettings(*args, _param_type=<object object>, **kwargs)¶
Bases:
schrodinger.models.parameters.CompoundParam
- Variables
HOST_PLACEHOLDER_ARGS – Placeholders to pass into the -HOST argument when no host is available based on the currently allowed host types.
- host¶
A parameter of the class.
- num_subjobs: int¶
A parameter of the class.
- allowed_host_types: schrodinger.tasks.jobtasks.AllowedHostTypes¶
A parameter of the class.
- CPU_PLACEHOLDER_ARG = '<CPU-host-placeholder>'¶
- GPU_PLACEHOLDER_ARG = '<GPU-host-placeholder>'¶
- CPU_AND_GPU_PLACEHOLDER_ARG = '<host-placeholder>'¶
- HOST_PLACEHOLDER_ARGS = {<AllowedHostTypes.CPU_ONLY: 1>: '<CPU-host-placeholder>', <AllowedHostTypes.GPU_ONLY: 2>: '<GPU-host-placeholder>', <AllowedHostTypes.CPU_AND_GPU: 3>: '<host-placeholder>'}¶
- toCmdArg()¶
- initializeValue()¶
Override to dynamically set up the default value of the param. Useful for default values that are determined at runtime. This is called any time the param is reset.
- classmethod adapter55040(json_dict)¶
- toJsonImplementation()¶
Returns a JSON representation of this value object.
Warning
This should never be called directly.
- classmethod fromJsonImplementation(json_dict)¶
Sets the value of this compound param value object from a JSON dict.
Warning
This should never be called directly.
- getHostPlaceholderArg() str ¶
Return the host placeholder argument for the currently allowed host types.
- allowed_host_typesChanged¶
A
pyqtSignal
emitted by instances of the class.
- allowed_host_typesReplaced¶
A
pyqtSignal
emitted by instances of the class.
- hostChanged¶
A
pyqtSignal
emitted by instances of the class.
- hostReplaced¶
A
pyqtSignal
emitted by instances of the class.
- num_subjobsChanged¶
A
pyqtSignal
emitted by instances of the class.
- num_subjobsReplaced¶
A
pyqtSignal
emitted by instances of the class.
- class schrodinger.tasks.jobtasks.IncorporationMode¶
Bases:
schrodinger.models.jsonable.JsonableEnum
- APPEND = 'append'¶
- APPENDINPLACE = 'appendinplace'¶
- REPLACE = 'replace'¶
- IGNORE = 'ignore'¶
- class schrodinger.tasks.jobtasks.IncorporationParam(*args, _param_type=<object object>, **kwargs)¶
Bases:
schrodinger.models.parameters.EnumParam
- DEFAULT_ALLOWED_MODES = (<IncorporationMode.APPEND: 'append'>, <IncorporationMode.APPENDINPLACE: 'appendinplace'>, <IncorporationMode.IGNORE: 'ignore'>)¶
- __init__(*args, allowed_modes=(<IncorporationMode.APPEND: 'append'>, <IncorporationMode.APPENDINPLACE: 'appendinplace'>, <IncorporationMode.IGNORE: 'ignore'>), **kwargs)¶
EnumParam must be initialized with the Enum class that this param is to be based on as well as the default value.
- Parameters
enum_class (enum.Enum) – the enum class to base this pram on
default_value (a member of the enum_class) – The default enum value. If not provided, the param will default to the first value of the enum.
- class schrodinger.tasks.jobtasks.JobConfig(*args, _param_type=<object object>, **kwargs)¶
Bases:
schrodinger.models.parameters.CompoundParam
Subclass JobConfig to customize what job settings are available for a given jobtask. To disable an option, set an ordinary (non-param) class variable with value None for that option.
Subclasses may add any arbitrary options as desired; it is the responsibility of the task to handle those options.
- viewname: str¶
A parameter of the class.
- jobname: str¶
A parameter of the class.
- host_settings: schrodinger.tasks.jobtasks.HostSettings¶
A parameter of the class.
- incorporation = None¶
- host_settingsChanged¶
A
pyqtSignal
emitted by instances of the class.
- host_settingsReplaced¶
A
pyqtSignal
emitted by instances of the class.
- jobnameChanged¶
A
pyqtSignal
emitted by instances of the class.
- jobnameReplaced¶
A
pyqtSignal
emitted by instances of the class.
- viewnameChanged¶
A
pyqtSignal
emitted by instances of the class.
- viewnameReplaced¶
A
pyqtSignal
emitted by instances of the class.
- schrodinger.tasks.jobtasks.job_config_factory(allowed_host_types=AllowedHostTypes.CPU_ONLY, default_incorp_mode=None, supports_subjobs=False, viewname=None)¶
Generate JobConfig objects with typical options.
- Parameters
allowed_host_types (AllowedHostTypes or None) – Whether this job accepts cpu hosts, gpu hosts, or both. Pass None to disable remote hosts (always run on localhost)
default_incorp_mode (IncorporationMode or None) – The default disposition. Pass None for jobs that do not incorporate at all.
supports_subjobs (bool) – whether this job can be split into subjobs
viewname (str or None) – what viewname should be used for this type of job
- class schrodinger.tasks.jobtasks.JobOutput(*args, _param_type=<object object>, **kwargs)¶
Bases:
schrodinger.models.parameters.CompoundParam
Base class for jobtask output.
- incorporation_file: schrodinger.tasks.tasks.TaskFile¶
A parameter of the class.
- incorporation_fileChanged¶
A
pyqtSignal
emitted by instances of the class.
- incorporation_fileReplaced¶
A
pyqtSignal
emitted by instances of the class.
- exception schrodinger.tasks.jobtasks.SetJobRuntimeError¶
Bases:
RuntimeError
An error while trying to a set a job on a task.
- class schrodinger.tasks.jobtasks.JobBackendCmdMixin(*args, cmd_list=None, **kwargs)¶
Bases:
schrodinger.tasks.jobtasks._AbstractJobMixin
Base class for running backends that already support job control. Combine with an AbstractCmdTask. To use, override
makeCmd
.- __init__(*args, cmd_list=None, **kwargs)¶
- makeCmd()¶
@overrides: tasks.AbstractCmdTask
Child classes must override.
- class schrodinger.tasks.jobtasks.ComboJobMixin(*args, cmd_list=None, **kwargs)¶
Bases:
schrodinger.tasks.jobtasks.JobBackendCmdMixin
Base class for running python code in a job using the “combo” task pattern. Combine with AbstractComboTask. To use, define:
mainFunction: the python function that will be executed in the backend process under job control.
- getLogFilename()¶
- getLogAsString() str ¶
- setJob(job: schrodinger.job.jobcontrol.Job)¶
” Use given
jobcontrol.Job
to incorporate job results into the task and run postprocessors. Example:task = FooTask() cmd = task.runToCommand() job = jobcontrol.launch_job(cmd) job.wait() task.setJob(job)
If the job has not been downloaded, the task will be set to FAILED with a SetJobRuntimeError.
- Parameters
job –
jobcontrol.Job
with results to incorporate into the task.
- write(skip_preprocessing: bool = False, cli: schrodinger.tasks.cli.CLI = None)¶
Write a .sh file with the command to run this task.
- makeCmd()¶
@overrides: tasks.AbstractCmdTask
Child classes must override.
- isBackendMode()¶
- getTaskDir()¶
- getTaskFilename(fname)¶
- runBackend()¶
@overrides: AbstractComboTask
- class schrodinger.tasks.jobtasks.CmdJobTask(*args, _param_type=<object object>, **kwargs)¶
Bases:
schrodinger.tasks.jobtasks.JobBackendCmdMixin
,schrodinger.tasks.tasks.AbstractCmdTask
Class for running backends that already support jobcontrol.
CmdJobTask can either be subclassed to implement custom input/output params and other behavior, or can be instantiated and run directly by supplying the optional cmd_list constructor argument. For example:
task = jobtasks.CmdJobTask(cmd_list=[‘testapp’, ‘-t’, ‘1’]) task.start()
CmdJobTask has a standard output that auto-populates with output files from its respective job. Custom output classes must inherit CmdJobTask.Output.
Note that specifying cmd_list will bypass some custom functionality and should not be used with CmdJobTask subclasses.
- Output¶
alias of
schrodinger.tasks.jobtasks._CmdJobTaskOutput
- __init__(*args, **kwargs)¶
- calling_contextChanged¶
A
pyqtSignal
emitted by instances of the class.
- calling_contextReplaced¶
A
pyqtSignal
emitted by instances of the class.
- failure_infoChanged¶
A
pyqtSignal
emitted by instances of the class.
- failure_infoReplaced¶
A
pyqtSignal
emitted by instances of the class.
- input: parameters.CompoundParam¶
A parameter of the class.
- inputChanged¶
A
pyqtSignal
emitted by instances of the class.
- inputReplaced¶
A
pyqtSignal
emitted by instances of the class.
- job_configChanged¶
A
pyqtSignal
emitted by instances of the class.
- job_configReplaced¶
A
pyqtSignal
emitted by instances of the class.
- max_progressChanged¶
A
pyqtSignal
emitted by instances of the class.
- max_progressReplaced¶
A
pyqtSignal
emitted by instances of the class.
- nameChanged¶
A
pyqtSignal
emitted by instances of the class.
- nameReplaced¶
A
pyqtSignal
emitted by instances of the class.
- output: parameters.CompoundParam¶
A parameter of the class.
- outputChanged¶
A
pyqtSignal
emitted by instances of the class.
- outputReplaced¶
A
pyqtSignal
emitted by instances of the class.
- progressChanged¶
A
pyqtSignal
emitted by instances of the class.
- progressReplaced¶
A
pyqtSignal
emitted by instances of the class.
- progress_stringChanged¶
A
pyqtSignal
emitted by instances of the class.
- progress_stringReplaced¶
A
pyqtSignal
emitted by instances of the class.
- statusChanged¶
A
pyqtSignal
emitted by instances of the class.
- statusReplaced¶
A
pyqtSignal
emitted by instances of the class.
- class schrodinger.tasks.jobtasks.ComboJobTask(*args, _param_type=<object object>, **kwargs)¶
Bases:
schrodinger.tasks.jobtasks.ComboJobMixin
,schrodinger.tasks.tasks.AbstractComboTask
- runBackend()¶
@overrides: AbstractComboTask
- getTaskDir()¶
Returns the full path of the task directory. This is only available if the task directory exists (after creation of the taskdir or, if no task dir is specified, any time).
- calling_contextChanged¶
A
pyqtSignal
emitted by instances of the class.
- calling_contextReplaced¶
A
pyqtSignal
emitted by instances of the class.
- failure_infoChanged¶
A
pyqtSignal
emitted by instances of the class.
- failure_infoReplaced¶
A
pyqtSignal
emitted by instances of the class.
- input: parameters.CompoundParam¶
A parameter of the class.
- inputChanged¶
A
pyqtSignal
emitted by instances of the class.
- inputReplaced¶
A
pyqtSignal
emitted by instances of the class.
- job_configChanged¶
A
pyqtSignal
emitted by instances of the class.
- job_configReplaced¶
A
pyqtSignal
emitted by instances of the class.
- max_progressChanged¶
A
pyqtSignal
emitted by instances of the class.
- max_progressReplaced¶
A
pyqtSignal
emitted by instances of the class.
- nameChanged¶
A
pyqtSignal
emitted by instances of the class.
- nameReplaced¶
A
pyqtSignal
emitted by instances of the class.
- outputChanged¶
A
pyqtSignal
emitted by instances of the class.
- outputReplaced¶
A
pyqtSignal
emitted by instances of the class.
- progressChanged¶
A
pyqtSignal
emitted by instances of the class.
- progressReplaced¶
A
pyqtSignal
emitted by instances of the class.
- progress_stringChanged¶
A
pyqtSignal
emitted by instances of the class.
- progress_stringReplaced¶
A
pyqtSignal
emitted by instances of the class.
- statusChanged¶
A
pyqtSignal
emitted by instances of the class.
- statusReplaced¶
A
pyqtSignal
emitted by instances of the class.