Exit non-zero when --exit-on-missing-checkpoint triggers - #6321
Draft
shanmugamr1992 wants to merge 1 commit into
Draft
Exit non-zero when --exit-on-missing-checkpoint triggers#6321shanmugamr1992 wants to merge 1 commit into
shanmugamr1992 wants to merge 1 commit into
Conversation
When `--exit-on-missing-checkpoint` is set and no checkpoint is found, `_load_base_checkpoint` called `sys.exit()`, which returns exit code 0. CI harnesses and other callers therefore treat the missing checkpoint as a successful run and continue, producing confusing downstream failures (e.g. an inference functional test that never writes its output and later fails with a FileNotFoundError on the golden-value comparison step). Exit with a non-zero status and a descriptive message that names the load directory and the missing tracker file, so a missing required checkpoint is surfaced clearly as a failure at its source. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: shanmugamr1992 <shanmugamr@nvidia.com>
santhnm2
approved these changes
Aug 6, 2026
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?
When
--exit-on-missing-checkpointis set and no checkpoint is found,_load_base_checkpoint(inmegatron/training/checkpointing.py) calledsys.exit()with no argument, i.e. exit code 0. Callers — notably CIfunctional-test harnesses — therefore treat a missing required checkpoint as
a successful run and continue, which produces confusing downstream
failures far from the real cause.
Concrete example: a dynamic-inference functional test whose checkpoint is not
staged in the CI artifacts tree exits cleanly (code 0) before generating
anything, never writes its
INFERENCE_OUTPUT_PATH, and then fails only at thegolden-value comparison step with an opaque
FileNotFoundError: .../golden_values_dev_dgx_h100.json— giving no hint thatthe checkpoint was the problem.
This PR makes the missing-checkpoint path fail loudly at its source:
sys.exit(1)) so callers/CI detect thefailure instead of silently treating exit code 0 as success.
--loaddirectory and the missingmetadata/tracker file.
Behavior change
--exit-on-missing-checkpointwith a missing checkpoint now returns a non-zeroexit code (previously 0). This flag is only meant to guard "this checkpoint is
required; stop if it's absent," so surfacing it as a failure is the intended
semantics and is consistent across its callers (inference examples, text
generation server, checkpoint converter).
Test plan
--loadpath that does notexist and confirm the job exits non-zero with the new message, instead of
exiting 0 and later failing on a missing golden/output file.
🤖 Generated with Claude Code