mache.parallel.slurm.get_slurm_job_state

mache.parallel.slurm.get_slurm_job_state(job_id: str) str | None[source]

Get the state of a Slurm job.

-t all is not optional here. Squeue’s default state filter hides jobs that have finished, so without it a job that ended within MinJobAge comes back as an empty listing that reports success, and that cannot be told apart from a healthy query with nothing to say.

Parameters:

job_id (str) – The job id to look up, normally the value of SLURM_JOB_ID.

Returns:

state (str or None) – The job’s state, such as 'RUNNING' or 'TIMEOUT', or None if the scheduler has no record of the job id.

Raises:

RuntimeError – If squeue could not be run or could not reach the controller, so that a live job cannot be ruled out.