hpcflow.app.SlurmPosix#
- class hpcflow.app.SlurmPosix(submit_cmd=None, show_cmd=None, del_cmd=None, js_cmd=None, login_nodes_cmd=None, array_switch=None, array_item_var=None, *args, **kwargs)#
Bases:
SlurmPosix
A scheduler that uses SLURM.
- Keyword Arguments:
- Parameters:
Notes
runs in current working directory by default [2]
References
[1] https://manpages.org/sbatch [2] https://ri.itservices.manchester.ac.uk/csf4/batch/sge-to-slurm/
Methods
Cancel submitted jobs.
Format the options to the scheduler.
Format a particular switch to use the JS command.
Query the scheduler to get the states of all of this user's jobs, optionally filtering by specified job IDs.
Get the command to use to submit a job to the scheduler.
Get the version of the scheduler.
Query if a jobscript is running/pending.
Test whether particular number of cores is supported in given range of cores.
Extract scheduler reference for a newly submitted jobscript
Perform scheduler-specific processing to the element resources.
Wait for jobscripts to update their state.
Attributes
Default shell variable with array ID.
Default prefix to enable array processing.
Default cancel command.
Default job control directive prefix.
Default command for logging into nodes.
Default pattern for matching the names of login nodes.
Default args for shebang line.
Default value for arguments to the shell.
Default shell.
Default command to show the queue state.
Default submission command.
Delay (in seconds) between attempts to query the state.
Number of times to try when querying the state.
Maps scheduler state codes to
JobscriptElementState
values.Unique properties, for hashing.
- DEFAULT_ARRAY_ITEM_VAR: ClassVar[str] = 'SLURM_ARRAY_TASK_ID'#
Default shell variable with array ID.
- DEFAULT_LOGIN_NODES_CMD: ClassVar[Sequence[str] | None] = None#
Default command for logging into nodes.
- DEFAULT_LOGIN_NODE_MATCH: ClassVar[str] = '*login*'#
Default pattern for matching the names of login nodes.
- DEFAULT_SHOW_CMD: ClassVar[Sequence[str]] = ('squeue', '--me')#
Default command to show the queue state.
- INTER_STATE_QUERY_DELAY: ClassVar[float] = 0.5#
Delay (in seconds) between attempts to query the state.
- cancel_jobs(js_refs, jobscripts=None, num_js_elements=0)#
Cancel submitted jobs.
- format_options(resources, num_elements, is_array, sub_idx)#
Format the options to the scheduler.
- Parameters:
resources (ElementResources) –
num_elements (int) –
is_array (bool) –
sub_idx (int) –
- Return type:
- format_switch(switch)#
Format a particular switch to use the JS command.
- get_job_state_info(*, js_refs=None, num_js_elements=0)#
Query the scheduler to get the states of all of this user’s jobs, optionally filtering by specified job IDs.
Jobs that are not in the scheduler’s status output will not appear in the output of this method.
- Parameters:
- Return type:
Mapping[str, Mapping[int | None, JobscriptElementState]]
- get_submit_command(shell, js_path, deps)#
Get the command to use to submit a job to the scheduler.
- get_version_info()#
Get the version of the scheduler.
- Return type:
VersionInfo
- is_jobscript_active(job_ID)#
Query if a jobscript is running/pending.
- static is_num_cores_supported(num_cores, core_range)#
Test whether particular number of cores is supported in given range of cores.
- parse_submission_output(stdout)#
Extract scheduler reference for a newly submitted jobscript
- classmethod process_resources(resources, scheduler_config)#
Perform scheduler-specific processing to the element resources.
Note
This mutates resources.
- Parameters:
resources (ElementResources) –
scheduler_config (SchedulerConfigDescriptor) –
- Return type:
None
- state_lookup: ClassVar[Mapping[str, JobscriptElementState]] = {'CANCELLED': JobscriptElementState.cancelled, 'COMPLETED': JobscriptElementState.finished, 'COMPLETING': JobscriptElementState.running, 'FAILED': JobscriptElementState.errored, 'OUT_OF_MEMORY': JobscriptElementState.errored, 'PENDING': JobscriptElementState.pending, 'RUNNING': JobscriptElementState.running, 'TIMEOUT': JobscriptElementState.errored}#
Maps scheduler state codes to
JobscriptElementState
values.