noether.core.schemas.slurm¶
Classes¶
Configuration for SLURM job submission via sbatch. |
Module Contents¶
- class noether.core.schemas.slurm.SlurmConfig(/, **data)¶
Bases:
pydantic.BaseModelConfiguration for SLURM job submission via sbatch.
All fields are optional and default to None, meaning the cluster default will be used. This schema covers all sbatch directives available in SLURM.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- partition: str | None = None¶
Partition to submit the job to (–partition). Multiple partitions can be comma-separated.
- nodes: int | str | None = None¶
Number of nodes to allocate (–nodes). Can be an integer or a range like ‘2-4’.
- gpus: str | int | None = None¶
count’, e.g. ‘v100:2’.
- Type:
Total GPUs for the job (–gpus). Can be a count or ‘type
- gpus_per_node: str | int | None = None¶
count’, e.g. ‘a100:4’.
- Type:
GPUs per node (–gpus-per-node). Can be a count or ‘type
- time: str | None = None¶
‘minutes’, ‘MM:SS’, ‘HH:MM:SS’, ‘D-HH’, ‘D-HH:MM’, ‘D-HH:MM:SS’.
- Type:
Wall clock time limit (–time). Formats
- begin: str | None = None¶
00:00’, ‘now+1hour’.
- Type:
Defer job start until the specified time (–begin), e.g. ‘2024-01-15T10
- output: str | None = None¶
%j (job ID), %x (job name), %A (array master ID), %a (array task ID), %N (node name), %u (user name).
- Type:
File path for stdout (–output). Supports replacement symbols
- array: str | None = None¶
Job array specification (–array), e.g. ‘0-15’, ‘1,3,5,7’, ‘1-7%2’ (max 2 concurrent).
- kill_on_invalid_dep: bool | None = None¶
Kill the job if any dependency is invalid (–kill-on-invalid-dep).
- env_path: str | None = None¶
Shell command to source before running the job (e.g. for activating a virtual environment) which should be used as ‘source env_path’.
- to_srun_args()¶
Return a string of srun arguments for all non-None SLURM fields.
Fields that are not actual srun directives (
experiment_file,source) are excluded. Boolean fields are rendered as bare flags whenTrueand omitted whenFalse.- Return type:
- classmethod validate_time_format(value)¶
Validate SLURM time format.
- classmethod validate_memory_format(value)¶
Validate SLURM memory format (number with optional K/M/G/T suffix).
- classmethod validate_array_format(value)¶
Validate SLURM array specification.