queue
#
Utilities for interacting with HPC queues
Classes:
-
SLURMOptions–Options for a Slurm job submission.
Functions:
-
submit_slurm_job–Submit a set of SLURM jobs to the queue
-
cancel_slurm_jobs–Cancel a set of SLURM jobs
-
wait_for_slurm_jobs–Wait for a set of SLURM jobs to finish, or attempt to cancel them if the
SLURMOptions
pydantic-model
#
Bases: BaseModel
Options for a Slurm job submission.
Fields:
-
n_nodes(int) -
n_tasks(int) -
n_cpus_per_task(int) -
n_gpus_per_task(int) -
walltime(str) -
partition(str) -
account(str | None) -
job_name(str) -
reservation(str | None)
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
to_flags
#
Convert this options to a list of sbatch / srun flags.
Source code in femto/fe/utils/queue.py
submit_slurm_job
#
submit_slurm_job(
command: list[str],
options: SLURMOptions,
log_file: Path,
dependencies: list[str] | None = None,
) -> str
Submit a set of SLURM jobs to the queue
Parameters:
-
command(list[str]) –The command to run.
-
options(SLURMOptions) –The SLURM options to use.
-
log_file(Path) –The file to write the SLURM output to.
-
dependencies(list[str] | None, default:None) –A list of SLURM job IDs to wait for before running this job.
Source code in femto/fe/utils/queue.py
cancel_slurm_jobs
#
Cancel a set of SLURM jobs
Parameters:
-
job_ids(Iterable[str]) –The IDs of the jobs to cancel.
wait_for_slurm_jobs
#
Wait for a set of SLURM jobs to finish, or attempt to cancel them if the program fails before they do.