mache.parallel.slurm.running_on_allocated_node
- mache.parallel.slurm.running_on_allocated_node() bool[source]
Whether this process is running on one of its allocation’s own nodes.
A process cannot still be running on a node of a finished allocation, because Slurm kills a job’s processes before it releases its nodes. So a host that appears in the job’s node list settles that the allocation is live, and settles it locally: nothing here asks the controller anything, which matters to a caller that starts a process per unit of work and would otherwise query once per process.
The answer is one way only.
Falsemeans the question was not settled here, not that the allocation has ended. A batch script’s node matches; a login shell still carryingSLURM_JOB_IDdoes not, and only the controller can say whether its allocation survives.There is one window where this and the controller disagree. Slurm kills a job’s processes
KillWaitseconds after it starts ending them, and the job isCOMPLETINGthroughout, which is not a live state. A process still alive in that window is on an allocated node while its job is ending, and this reports it live. It tracks the site’sKillWait: 88.4 s against a configured 90 on Chrysalis, and 27.1 s against a configured 30 on Perlmutter. The process it affects is one already being torn down and about to be killed outright.- Returns:
on_node (bool) –
Trueif this host is one of the allocation’s nodes,Falseif it is not or if that could not be established locally.