romtools.hpc.components.slurm_job_manager#

SLURM job submission and monitoring for the dispatchers.

Classes

SlurmJobManager(run_cmd, *, files[, config, ...])

Generates and submits SLURM scripts, then polls the job until it finishes.

class romtools.hpc.components.slurm_job_manager.SlurmJobManager(run_cmd, *, files, config=None, logger=None, campaign_directory=None)[source]#

Bases: CampaignComponent

Generates and submits SLURM scripts, then polls the job until it finishes.

Serves both dispatchers, since sbatch/squeue/sacct are the same wherever they are issued.

Parameters:
  • run_cmd (Callable[[str], Result]) – Runs a shell command where the scheduler lives and returns a Result. Connection.run for a remote host, run_local_bash for this one.

  • campaign_directory (str) – The directory jobs run in when no run_directory is given

  • files (BaseFileManager) – The file manager for the machine the job runs on

  • config (dict)

  • logger (Logger)

submit(cmd=None, run_directory=None)[source]#

Generate, stage, and submit a SLURM script, returning the job ID.

Parameters:
  • cmd (str)

  • run_directory (str)

Return type:

str

wait(job_id)[source]#

Block until the SLURM job leaves the queue, then return its exit code in Python style (negative for a signal), or None if sacct never reported.

Parameters:

job_id (str)

Return type:

str