Skip to content

Make step_latest symlink update atomic - #62

Merged
Hannibal046 merged 1 commit into
deepseek-ai:mainfrom
jessiewei7:fix/atomic-step-latest-symlink
Jul 9, 2026
Merged

Make step_latest symlink update atomic#62
Hannibal046 merged 1 commit into
deepseek-ai:mainfrom
jessiewei7:fix/atomic-step-latest-symlink

Conversation

@jessiewei7

Copy link
Copy Markdown
Contributor

What

safe_symlink unlinks the old symlink before creating the new one. A crash between the two calls deletes step_latest entirely, so discover_latest_checkpoint() returns None and the next launch silently retrains from scratch — even though a complete checkpoint is sitting on disk.

Change

Create the symlink under a temporary name and os.replace it over the target. The replace is atomic, so step_latest always points at a complete checkpoint.

safe_symlink unlinks the old symlink before creating the new one. A crash
between the two calls deletes step_latest entirely, so the next launch
finds no checkpoint and silently retrains from scratch. Create the symlink
under a temporary name and os.replace it over the target instead, so
step_latest always points at a complete checkpoint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants