schrodinger.tasks.slurmtasks module

class schrodinger.tasks.slurmtasks.JobState

Bases: Enum

PENDING = 'PENDING'
RUNNING = 'RUNNING'
COMPLETED = 'COMPLETED'
FAILED = 'FAILED'
CANCELLED = 'CANCELLED'
TIMEOUT = 'TIMEOUT'
NODE_FAIL = 'NODE_FAIL'
PREEMPTED = 'PREEMPTED'
SUSPENDED = 'SUSPENDED'
STOPPED = 'STOPPED'
BOOT_FAIL = 'BOOT_FAIL'
COMPLETING = 'COMPLETING'
CONFIGURING = 'CONFIGURING'
UNKNOWN = 'UNKNOWN'
schrodinger.tasks.slurmtasks.submit_slurm_job(job_cmd: list[str], partition: str, job_name: str = None, output: str = None, launch_dir=None)

Submit a SLURM job with optional job name and output file.

Returns:

the SLURM job ID

schrodinger.tasks.slurmtasks.check_slurm_jobs(job_ids: list[str]) dict[str, tuple[JobState, str]]

Check the status of SLURM jobs using the sacct command.

Returns:

a dictionary mapping job IDs to tuples of (JobState, exit code)

schrodinger.tasks.slurmtasks.check_slurm_job(job_id: str) tuple[JobState, str]

Check the status of a single SLURM job using the sacct command. If multiple jobs need to be checked, use check_slurm_jobs instead.

Returns:

a tuple of (JobState, exit code)

class schrodinger.tasks.slurmtasks.SlurmMonitor(**kwargs)

Bases: QObject

polling_interval_ms = 1000
__init__(**kwargs)
stop()
addJob(job_id: str, callback: Callable)
schrodinger.tasks.slurmtasks.monitor_slurm_job(job_id: str, callback: Callable)

Monitor a slurm job and call a callback when the job terminates.

class schrodinger.tasks.slurmtasks.ComboSlurmTask(*args, _param_type=<object object>, **kwargs)

Bases: AbstractComboTask

A ComboTask that executes on a SLURM cluster. Because SLURM does not manage copying of input and output files, the calling code is responsible for ensuring that files are in an accessible location.

job_id

This class can be used to declare a public attribute on a CompoundParam. Declared public attributes can be used without error.

Example usage:

class Coord(CompoundParam):
    x: int
    y: int
    note = NonParamAttribute()

coord = Coord()
coord.note = "hello" # No error
class JobConfig(*args, _param_type=<object object>, **kwargs)

Bases: CompoundParam

partition: str

A parameter of the class.

partitionChanged

A pyqtSignal emitted by instances of the class.

partitionReplaced

A pyqtSignal emitted by instances of the class.

runCmd(cmd)
makeCmd()

@overrides: AbstractCmdTask

getLogFilename()
getLogAsString() str
runBackend()
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.

inputChanged

A pyqtSignal emitted by instances of the class.

inputReplaced

A pyqtSignal emitted by instances of the class.

job_config

A parameter 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.

class schrodinger.tasks.slurmtasks.FooTask(*args, _param_type=<object object>, **kwargs)

Bases: ComboSlurmTask

class Input(*args, _param_type=<object object>, **kwargs)

Bases: CompoundParam

bar: str

A parameter of the class.

infile: TaskFile

A parameter of the class.

barChanged

A pyqtSignal emitted by instances of the class.

barReplaced

A pyqtSignal emitted by instances of the class.

infileChanged

A pyqtSignal emitted by instances of the class.

infileReplaced

A pyqtSignal emitted by instances of the class.

class Output(*args, _param_type=<object object>, **kwargs)

Bases: CompoundParam

baz: str

A parameter of the class.

outfile: TaskFile

A parameter of the class.

bazChanged

A pyqtSignal emitted by instances of the class.

bazReplaced

A pyqtSignal emitted by instances of the class.

outfileChanged

A pyqtSignal emitted by instances of the class.

outfileReplaced

A pyqtSignal emitted by instances of the class.

mainFunction()
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: 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_config

A parameter 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: 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.

schrodinger.tasks.slurmtasks.main()

Since we can’t run slurm jobs in the test suite, this is a simple test.