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.
- schrodinger.tasks.jobtasks.set_task_host_to_backend_host(task)¶
Add host information from the current process (driver) to the given sub-task. Typically needed if the sub-task is a driver itself, and is able to create multiple subjobs.
- class schrodinger.tasks.jobtasks.AllowedHostTypes¶
Bases:
JsonableEnum
- CPU_ONLY = 1¶
- GPU_ONLY = 2¶
- CPU_AND_GPU = 3¶
- class schrodinger.tasks.jobtasks.HostSettings(*args, _param_type=<object object>, **kwargs)¶
Bases:
CompoundParam
- name: str¶
A parameter of the class.
- num_subjobs: int¶
A parameter of the class.
- allowed_host_types: 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() str ¶
- classmethod adapter55039(json_dict)¶
hosts.Host
objects are now serialized to/from string using only the host name.
- classmethod adapter70070(json_dict)¶
The
Host
param has been replaced with the host name. Since a previous adapter already serialized to/from host name, here we just need to change the dict key.
- 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.
- nameChanged¶
A
pyqtSignal
emitted by instances of the class.
- nameReplaced¶
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:
JsonableEnum
- APPEND = 'append'¶
- APPENDINPLACE = 'appendinplace'¶
- REPLACE = 'replace'¶
- IGNORE = 'ignore'¶
- class schrodinger.tasks.jobtasks.IncorporationParam(*args, _param_type=<object object>, **kwargs)¶
Bases:
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:
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: 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:
CompoundParam
Base class for jobtask output.
- 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:
_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:
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: 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: 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:
JobBackendCmdMixin
,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
_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:
ComboJobMixin
,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.