kempnerforge.resilience.elastic¶
Elastic training and SLURM integration helpers.
Provides utilities for training jobs that may be preempted, requeued, or restarted with a different number of nodes:
SLURM job info detection
Requeue detection
Auto-resume path resolution
Functions
Read SLURM job information from environment variables. |
|
Check if we are running under SLURM. |
|
Check if this is a requeued SLURM job. |
|
Log SLURM job information (if running under SLURM). |
|
|
Find the latest checkpoint for auto-resume. |
Classes
Information about the current SLURM job. |
- class kempnerforge.resilience.elastic.SLURMInfo[source]¶
Bases:
objectInformation about the current SLURM job.
- kempnerforge.resilience.elastic.get_slurm_info()[source]¶
Read SLURM job information from environment variables.
- Returns:
SLURMInfo if running under SLURM, None otherwise.
- Return type:
SLURMInfo | None
- kempnerforge.resilience.elastic.is_slurm_job()[source]¶
Check if we are running under SLURM.
- Return type:
- kempnerforge.resilience.elastic.is_slurm_requeue()[source]¶
Check if this is a requeued SLURM job.
Uses
SLURM_RESTART_COUNT(set by SLURM on requeue).- Return type:
- kempnerforge.resilience.elastic.resolve_resume_path(checkpoint_dir)[source]¶
Find the latest checkpoint for auto-resume.
- Checks:
{checkpoint_dir}/latestsymlinkMost recent
step_Ndirectory whose DCP shards are durable
CheckpointManageronly ever pointslatestat a durable checkpoint, so (1) needs no further test. Thestep_Nfallback has no such guarantee: an interrupted save leaves a directory that exists but holds no.metadata, and resuming into it fails indcp.loadwith “metadata is None”. Skipping incomplete directories turns an unrecoverable run into one that resumes from the last durable checkpoint, whatever left the partial directory behind.