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.StreamedTaskFile(value='', *args, **kwargs)¶
Bases:
TaskFileThe path to a file that should be marked as streaming in jobcontrol. See jobcontrol documentation for more information on streamed files. Unlike TaskFile, these files do not get processed by the tasks framework.
Compatible only with
ComboJobTaskoutput params.
- 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.Hostobjects are now serialized to/from string using only the host name.
- classmethod adapter70070(json_dict)¶
The
Hostparam 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
pyqtSignalemitted by instances of the class.
- allowed_host_typesReplaced¶
A
pyqtSignalemitted by instances of the class.
- nameChanged¶
A
pyqtSignalemitted by instances of the class.
- nameReplaced¶
A
pyqtSignalemitted by instances of the class.
- num_subjobsChanged¶
A
pyqtSignalemitted by instances of the class.
- num_subjobsReplaced¶
A
pyqtSignalemitted 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- __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:
CompoundParamSubclass 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¶
- getHostArgs() list[str]¶
- getDispArgs() list[str]¶
- host_settingsChanged¶
A
pyqtSignalemitted by instances of the class.
- host_settingsReplaced¶
A
pyqtSignalemitted by instances of the class.
- jobnameChanged¶
A
pyqtSignalemitted by instances of the class.
- jobnameReplaced¶
A
pyqtSignalemitted by instances of the class.
- viewnameChanged¶
A
pyqtSignalemitted by instances of the class.
- viewnameReplaced¶
A
pyqtSignalemitted 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.JobSettings(*args, _param_type=<object object>, **kwargs)¶
Bases:
CompoundParamThe jobcontrol settings available for a given jobtask. This class should not be subclassed.
- host: str¶
A parameter of the class.
- incorporation_mode: IncorporationMode¶
A parameter of the class.
- viewname: str¶
A parameter of the class.
- getHostArgs() list[str]¶
- getDispArgs() list[str]¶
- hostChanged¶
A
pyqtSignalemitted by instances of the class.
- hostReplaced¶
A
pyqtSignalemitted by instances of the class.
- incorporation_modeChanged¶
A
pyqtSignalemitted by instances of the class.
- incorporation_modeReplaced¶
A
pyqtSignalemitted by instances of the class.
- viewnameChanged¶
A
pyqtSignalemitted by instances of the class.
- viewnameReplaced¶
A
pyqtSignalemitted by instances of the class.
- class schrodinger.tasks.jobtasks.SubjobSettings(*args, _param_type=<object object>, **kwargs)¶
Bases:
CompoundParamAdd this as an input subparam to specify how a particular subjob should be queued and executed. This data must be set on a JobDJ in order to take effect.
SubjobSettings should be defined inside of a task’s input param.
- Variables:
host – The host on which to run the subjob. If None, this value will be inherited from the job backend environment.
max_procs – The maximum number of processors to use for the subjob. If None, this value will be inherited from the job backend environment.
- host: str¶
A parameter of the class.
- max_procs: int¶
A parameter of the class.
- initializeValue()¶
Get the host and max_procs from the job environment, if available.
- hostChanged¶
A
pyqtSignalemitted by instances of the class.
- hostReplaced¶
A
pyqtSignalemitted by instances of the class.
- max_procsChanged¶
A
pyqtSignalemitted by instances of the class.
- max_procsReplaced¶
A
pyqtSignalemitted by instances of the class.
- class schrodinger.tasks.jobtasks.JobOutput(*args, _param_type=<object object>, **kwargs)¶
Bases:
CompoundParamBase class for jobtask output.
- incorporation_fileChanged¶
A
pyqtSignalemitted by instances of the class.
- incorporation_fileReplaced¶
A
pyqtSignalemitted by instances of the class.
- exception schrodinger.tasks.jobtasks.SetJobRuntimeError¶
Bases:
RuntimeErrorAn error while trying to a set a job on a task.
- class schrodinger.tasks.jobtasks.JobBackendCmdMixin(*args, cmd_list=None, **kwargs)¶
Bases:
_AbstractJobMixinBase 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:
JobBackendCmdMixinBase 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.Jobto 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.Jobwith results to incorporate into the task.
- write(skip_preprocessing: bool = False, cli: TaskCLI = 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,AbstractCmdTaskClass 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
pyqtSignalemitted by instances of the class.
- calling_contextReplaced¶
A
pyqtSignalemitted by instances of the class.
- failure_infoChanged¶
A
pyqtSignalemitted by instances of the class.
- failure_infoReplaced¶
A
pyqtSignalemitted by instances of the class.
- input: CompoundParam¶
A parameter of the class.
- inputChanged¶
A
pyqtSignalemitted by instances of the class.
- inputReplaced¶
A
pyqtSignalemitted by instances of the class.
- job_configChanged¶
A
pyqtSignalemitted by instances of the class.
- job_configReplaced¶
A
pyqtSignalemitted by instances of the class.
- job_settings: JobSettings¶
A parameter of the class.
- job_settingsChanged¶
A
pyqtSignalemitted by instances of the class.
- job_settingsReplaced¶
A
pyqtSignalemitted by instances of the class.
- max_progressChanged¶
A
pyqtSignalemitted by instances of the class.
- max_progressReplaced¶
A
pyqtSignalemitted by instances of the class.
- nameChanged¶
A
pyqtSignalemitted by instances of the class.
- nameReplaced¶
A
pyqtSignalemitted by instances of the class.
- output: CompoundParam¶
A parameter of the class.
- outputChanged¶
A
pyqtSignalemitted by instances of the class.
- outputReplaced¶
A
pyqtSignalemitted by instances of the class.
- progressChanged¶
A
pyqtSignalemitted by instances of the class.
- progressReplaced¶
A
pyqtSignalemitted by instances of the class.
- progress_stringChanged¶
A
pyqtSignalemitted by instances of the class.
- progress_stringReplaced¶
A
pyqtSignalemitted by instances of the class.
- statusChanged¶
A
pyqtSignalemitted by instances of the class.
- statusReplaced¶
A
pyqtSignalemitted 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
pyqtSignalemitted by instances of the class.
- calling_contextReplaced¶
A
pyqtSignalemitted by instances of the class.
- failure_infoChanged¶
A
pyqtSignalemitted by instances of the class.
- failure_infoReplaced¶
A
pyqtSignalemitted by instances of the class.
- input: CompoundParam¶
A parameter of the class.
- inputChanged¶
A
pyqtSignalemitted by instances of the class.
- inputReplaced¶
A
pyqtSignalemitted by instances of the class.
- job_configChanged¶
A
pyqtSignalemitted by instances of the class.
- job_configReplaced¶
A
pyqtSignalemitted by instances of the class.
- job_settings: JobSettings¶
A parameter of the class.
- job_settingsChanged¶
A
pyqtSignalemitted by instances of the class.
- job_settingsReplaced¶
A
pyqtSignalemitted by instances of the class.
- max_progressChanged¶
A
pyqtSignalemitted by instances of the class.
- max_progressReplaced¶
A
pyqtSignalemitted by instances of the class.
- nameChanged¶
A
pyqtSignalemitted by instances of the class.
- nameReplaced¶
A
pyqtSignalemitted by instances of the class.
- outputChanged¶
A
pyqtSignalemitted by instances of the class.
- outputReplaced¶
A
pyqtSignalemitted by instances of the class.
- progressChanged¶
A
pyqtSignalemitted by instances of the class.
- progressReplaced¶
A
pyqtSignalemitted by instances of the class.
- progress_stringChanged¶
A
pyqtSignalemitted by instances of the class.
- progress_stringReplaced¶
A
pyqtSignalemitted by instances of the class.
- statusChanged¶
A
pyqtSignalemitted by instances of the class.
- statusReplaced¶
A
pyqtSignalemitted by instances of the class.