matflow.SlurmPosix#
- class matflow.SlurmPosix(directives=None, options=None, 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:
- directives (dict) – Scheduler directives. Each item is written verbatim in the jobscript as a scheduler directive, and is not processed in any way. If a value is None, the key is considered a flag-like directive. If a value is a list, multiple directives will be printed to the jobscript with the same key, but different values. 
- 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 directives 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. - File name of combined standard output and error streams. - File name of the standard error stream file. - File name of the standard output stream file. - 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 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 - JobscriptElementStatevalues.- 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)#
- Cancel submitted jobs. 
 - format_directives(resources, num_elements, is_array, sub_idx, js_idx)#
- Format the directives to the scheduler. 
 - format_switch(switch)#
- Format a particular switch to use the JS command. 
 - get_job_state_info(*, js_refs=None)#
- 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. 
 - get_std_out_err_filename(js_idx, job_ID, array_idx=None)#
- File name of combined standard output and error streams. - Notes - We use the standard output stream filename format for the combined output and error streams file. 
 - get_stderr_filename(js_idx, job_ID, array_idx=None)#
- File name of the standard error stream file. 
 - get_stdout_filename(js_idx, job_ID, array_idx=None)#
- File name of the standard output stream file. 
 - 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 - JobscriptElementStatevalues.