-
Notifications
You must be signed in to change notification settings - Fork 2k
[None][infra] add retry logic to get slurm sbatch job log when ssh dropped #9167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[None][infra] add retry logic to get slurm sbatch job log when ssh dropped #9167
Conversation
|
/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1" |
|
PR_Github #24553 [ run ] triggered by Bot. Commit: |
📝 WalkthroughWalkthroughThe PR refactors Slurm job submission in Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant G as Groovy Pipeline
participant LS as Local System
participant RS as Remote System
participant S as Slurm
rect rgb(230, 240, 250)
Note over G,S: Submission Stage
G->>LS: Write submission script<br/>(slurm_submit.sh)
LS->>RS: Copy to remote node
G->>RS: Execute slurm_submit.sh
RS->>S: Submit job via sbatch
S-->>RS: Return job ID
RS->>RS: Write job ID to file
end
rect rgb(250, 235, 230)
Note over G,S: Tracking Stage
G->>LS: Write tracking script<br/>(slurm_track.sh)
LS->>RS: Copy to remote node
G->>RS: Execute slurm_track.sh
RS->>S: Poll squeue for status
rect rgb(240, 250, 240)
Note over RS,S: Loop until complete
S-->>RS: Job status
RS->>RS: Tail job output
end
S-->>RS: Job completed
RS->>S: Query sacct for exit code
S-->>RS: Exit code
end
rect rgb(240, 245, 250)
Note over G,RS: Result Reporting
RS-->>G: Success/Failure status
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Areas requiring extra attention:
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
jenkins/L0_Test.groovy (1)
967-981: Consider avoidingwriteFilefor generated scripts in containerized agentsYou’re using
pipeline.writeFileto create the newslurm_submit.shandslurm_track.shtemp files:pipeline.writeFile(file: scriptSubmitPathLocal, text: scriptSubmit) ... pipeline.writeFile(file: scriptTrackPathLocal, text: scriptTrack)We’ve previously seen Jenkins containerized agents hit permission issues with
writeFilein some workspaces, and switched to shell redirection as a more robust pattern. For these new scripts, you might want to follow the same approach, e.g.:sh """cat > ${scriptSubmitPathLocal} << 'EOF' ${scriptSubmit} EOF """and similarly for
scriptTrackPathLocal.Not strictly required if your current agents are happy with
writeFile, but aligning with the established workaround can reduce flakiness across different Jenkins environments.Based on learnings
Also applies to: 999-1018
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
jenkins/L0_Test.groovy(4 hunks)jenkins/scripts/slurm_run.sh(0 hunks)
💤 Files with no reviewable changes (1)
- jenkins/scripts/slurm_run.sh
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-09T13:27:24.027Z
Learnt from: EmmaQiaoCh
Repo: NVIDIA/TensorRT-LLM PR: 7497
File: jenkins/L0_Test.groovy:0-0
Timestamp: 2025-09-09T13:27:24.027Z
Learning: In Jenkins Pipeline containerized environments, `writeFile` can have permission issues when writing to workspace directories. Using `sh "echo 'content' > file"` is a common and effective workaround to avoid these permission problems.
Applied to files:
jenkins/L0_Test.groovy
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (1)
jenkins/L0_Test.groovy (1)
990-1017: Simplify tracking flow and add SSH error handling; note squeue behavior differs from assumptionThe two-stage submit/track flow is good, but has robustness gaps:
SSH drops during
slurm_track.shexecution can abort the stage without retry.
- Line 1032:
Utils.exec(... scriptExecPathNode)has noretry,catchError, or explicit status handling.- If SSH drops while
tail -forsqueueruns, the stage will abort before the outerwhile (true)loop can retry.Double-polling via both
slurm_track.shand outer while-loop is redundant.
slurm_track.shalready pollssqueue(line 1006), tails output, and determines final exit viasacct(line 1015).- The outer
while (true)(lines 1034–1050) adds a secondsqueue-polling layer, complicating logic unnecessarily.
squeueexit code behavior differs from the original concern:
squeuereturns exit code 0 when it runs successfully, even if the queried job is no longer in the queue (it simply produces no output).- Non-zero exits indicate Slurm errors, not "job not found."
- Therefore,
result == ""check (line 1048) is correct and will succeed when the job completes.Suggested simplification:
- Wrap the initial
Utils.execcall (line 1032) in aretryblock to handle SSH drops:retry(3) { Utils.exec(pipeline, timeout: false, script: Utils.sshUserCmd(remote, scriptExecPathNode)) }- Remove the outer
while (true)loop (lines 1034–1050) sinceslurm_track.shis the authoritative tracking mechanism and will exit when complete.
|
PR_Github #24553 [ run ] completed with state |
821fb59 to
21528b7
Compare
|
/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1" |
|
PR_Github #24614 [ run ] triggered by Bot. Commit: |
|
PR_Github #24614 [ run ] completed with state |
21528b7 to
727b4b9
Compare
|
/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1" |
|
PR_Github #24631 [ run ] triggered by Bot. Commit: |
|
PR_Github #24631 [ run ] completed with state |
727b4b9 to
35f9d5c
Compare
|
/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1" |
|
PR_Github #24634 [ run ] triggered by Bot. Commit: |
|
PR_Github #24634 [ run ] completed with state |
|
/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1" |
|
PR_Github #24802 [ run ] triggered by Bot. Commit: |
|
PR_Github #24802 [ run ] completed with state |
35f9d5c to
c5f522d
Compare
|
/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1" |
|
PR_Github #24939 [ run ] triggered by Bot. Commit: |
|
PR_Github #24939 [ run ] completed with state |
c5f522d to
0b204ca
Compare
|
PR_Github #29468 [ run ] triggered by Bot. Commit: |
|
PR_Github #29468 [ run ] completed with state |
|
/bot run |
|
PR_Github #29488 [ run ] triggered by Bot. Commit: |
|
PR_Github #29488 [ run ] completed with state
|
|
/bot run |
|
PR_Github #29549 [ run ] triggered by Bot. Commit: |
|
PR_Github #29549 [ run ] completed with state
|
|
/bot run |
|
PR_Github #29661 [ run ] triggered by Bot. Commit: |
|
PR_Github #29661 [ run ] completed with state |
f1184bd to
08ef6c2
Compare
|
/bot run —post-merge --disable-fail-fast |
|
PR_Github #30198 Bot args parsing error: usage: /bot [-h] |
|
/bot run --post-merge --disable-fail-fast |
|
PR_Github #30202 [ run ] triggered by Bot. Commit: |
|
PR_Github #30202 [ run ] completed with state
|
08ef6c2 to
1de3717
Compare
|
/bot run |
Signed-off-by: Yuanjing Xue <[email protected]>
Signed-off-by: Yuanjing Xue <[email protected]>
Signed-off-by: Yuanjing Xue <[email protected]>
Signed-off-by: Yuanjing Xue <[email protected]>
1de3717 to
849402f
Compare
|
/bot run |
|
PR_Github #30305 [ run ] triggered by Bot. Commit: |
|
PR_Github #30305 [ run ] completed with state
|
|
/bot run --stage-list="GB200-8_GPUs-2_Nodes-PyTorch-1" |
|
PR_Github #30320 [ run ] triggered by Bot. Commit: |
|
PR_Github #30320 [ run ] completed with state
|
Description
add retry logic to get slurm sbatch job log when ssh dropped
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.
Summary by CodeRabbit
Refactor
Chores