Repository navigation
feat(checkpoint): snapshot rollouts at the checkpoint deadline - #5056
Open
macandro96 wants to merge 1 commit into
Open
macandro96 wants to merge 1 commit into
macandro96 wants to merge 1 commit into
Conversation
When checkpointing.checkpoint_must_save_by fired after a train step, the controller saved a trainer checkpoint and stopped at once. A trainer checkpoint holds no environment state, and stopping cancelled the snapshot pump before it could save one, so a turn-level run lost every unfinished turn at the deadline. Rollout snapshots are now on when snapshot_attempt_interval_s is set or rollout_recovery.target_level is "turn". With turn-level recovery: - The trainer checkpoint the deadline triggers is followed by a forced rollout snapshot before the run stops. A failure that leaves checkpoint state consistent only warns; the trainer checkpoint is still durable. - New rollout_checkpointing.snapshot_on_trainer_checkpoint (default true) keeps today's snapshot after every other trainer checkpoint. false with no interval saves environment state only at the deadline. - snapshot_attempt_interval_s is no longer required. Setup instead rejects a turn-level config that would never save. - The pump waits only for wakeups when no interval is set, and before the first step also for the deadline. Each snapshot also records how long it took, and the deadline is moved earlier by that much, so the trainer checkpoint and the snapshot both fit. Deferred checkpoint finalize stays rejected with an interval or with a snapshot after every trainer checkpoint; deadline-only is allowed, because the deadline publishes step_N before its snapshot. Unit: 563 passed (checkpointing, setup, timer and trace tests), Gym lane 7 passed. ruff and pyrefly clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Anish Mahishi <amahishi@nvidia.com>
macandro96
force-pushed
the
amahishi/rollout-deadline-snapshot
branch
from
November 6, 2026 20:20
dea7ae5 to
a97d834
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Saves a rollout snapshot at the
checkpointing.checkpoint_must_save_bydeadline, so a turn-level run keeps its unfinished turns across a walltime stop, and lets a run save environment state only at that deadline.Stacked on #5049 (batch age).
Why
When the deadline fired after a train step, the controller saved a trainer checkpoint and stopped at once. A trainer checkpoint holds no environment state, and stopping cancelled the snapshot pump before it could save one, so every unfinished turn was redone after the restore. There was also no way to save environment state only at the end: turn-level recovery required
snapshot_attempt_interval_s.Config
The recovery config decides what a snapshot preserves; these two fields decide when, beyond the deadline save, which is automatic with turn-level recovery.
snapshot_on_trainer_checkpointsnapshot_attempt_interval_struenullfalsenulltrue300How it works
rollout_recovery.target_levelisturn(rollout_snapshots_enabled). This replaces the eight checks of the interval in validation, data-plane support, bootstrap identity, restore and the pump.RolloutSnapshotter.save_at_deadline(), a forced snapshot, before it stops. A failure that leaves checkpoint state consistent only warns, since the trainer checkpoint is durable; an invariant failure still raises.TimeoutChecker.save_reserve_seconds, and the deadline fires that much earlier, so the trainer checkpoint and the snapshot both fit.Notes for review
snapshot_on_trainer_checkpoint: false, no interval and nocheckpoint_must_save_by, which would never save.snapshot_on_trainer_checkpointat turn level. Deadline-only is allowed: the deadline publishesstep_Nbefore its snapshot, and the run then stops.Testing
🤖 Generated with Claude Code