fix(tests): validate training completion in UT and capture torchrun exit code#620
Open
WangLingxun wants to merge 1 commit intomainfrom
Open
fix(tests): validate training completion in UT and capture torchrun exit code#620WangLingxun wants to merge 1 commit intomainfrom
WangLingxun wants to merge 1 commit intomainfrom
Conversation
…xit code
1. Shell fix (primus-cli-direct.sh):
- Add before so the script does not exit
immediately on non-zero torchrun return code, allowing proper
error logging before exit.
2. UT validation (tests/utils.py → run_training_script):
- Extract common training-script execution logic into a shared
'run_training_script()' helper, replacing duplicated code across
test_megatron_trainer, test_torchtitan_trainer, and
test_maxtext_trainer.
- In the success path (exit code 0), assert that the PrimusRuntime
'Training completed.' marker is present in the log file. This
catches silent training failures where torchrun returns 0 but
training did not actually finish (e.g. AITER HIP errors).
8e38f26 to
1da90ca
Compare
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.
Shell fix (primus-cli-direct.sh):
set +ebeforeeval "$CMD"so the script does not exitimmediately on non-zero torchrun return code, allowing proper
error logging before exit.
UT validation (tests/utils.py → run_training_script):
'run_training_script()' helper, replacing duplicated code across
test_megatron_trainer, test_torchtitan_trainer, and
test_maxtext_trainer.
'Training completed.' marker is present in the log file. This
catches silent training failures where torchrun returns 0 but
training did not actually finish (e.g. AITER HIP errors).