Resumable Runs
A long evaluation can outlive one allocation: the walltime runs out, the job is preempted, or a node fails. Marking a benchmark resumable makes its Slurm job a self-chaining sequence. When one job is killed by the scheduler, a successor starts and the run continues from the rollouts already collected instead of from zero.
To tune it, pass a mapping instead of true:
Only executors that support it may set resumable, and Slurm does. The setting is per benchmark.
How it works
The job script begins with a prologue that runs before any service starts. Each job in the chain receives its predecessor’s Slurm job ID, looks at that job’s final state with sacct, and decides whether to carry on. Before doing any real work, it queues its own successor with sbatch --dependency=afternotok:<this job> --kill-on-invalid-dep=yes, so the chain continues even if this job is killed mid-run.
If a job finishes successfully, its queued successor has a dependency that can never be satisfied, and Slurm cancels it. The chain needs no explicit cleanup step on success.
What the next job does with the previous job’s state:
Time limits, preemption, and node failure are not counted against max_retries, which exists so a job whose own script is broken does not requeue forever.
What gets resumed
Submit adds resume_from_cache: true to the benchmark’s run overrides unless you set it yourself. On the first job there is no cache and it starts fresh; on later jobs gym eval run reuses what was already collected. All jobs of a chain share one benchmark directory, so rollouts accumulate in the same artifacts/ files, and each job’s logs are kept separately because their file names include the Slurm job ID.
The prologue keeps its state in dot-files in the benchmark directory:
Limits and caveats
max_walltimeis checked when the previous job ended by timeout, preemption, or node failure, against the walltime of the jobs that already finished. When it is reached the chain stops and exits with status 0, so a stopped chain is not an error.- If queueing a successor fails, the job prints a warning (
Chain will NOT continue on failure) and carries on; that job just has no successor. - A job that finds its predecessor
CANCELLEDstops the chain. Because each job queues its successor before doing work, a successor may already be waiting in the queue when you cancel; checksqueueand cancel any job still pending, using.gym_job_chainfor the IDs of the jobs that have run. resumabledoes not work with a benchmarkcommand, because resuming relies ongym eval run’s cache.- The
gym-job.jsonrecord contains the first job’s ID only.