-
Notifications
You must be signed in to change notification settings - Fork 2k
[None][infra] Some improvements for Slurm execution path in the CI #10316
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
Conversation
58620d5 to
de2ea25
Compare
📝 WalkthroughWalkthroughThe pull request upgrades Slurm-based test infrastructure reliability by introducing a retry utility function, applying retry logic to installation and status polling operations, converting enum comparisons to string-based checks, and refactoring exit code tracking to aggregate failures across multiple test phases. Changes
Sequence DiagramssequenceDiagram
participant Jenkins as Jenkins (Groovy)
participant Slurm as Slurm Controller
participant Node as Remote Node
participant Sacct as sacct
rect rgb(240, 248, 255)
note over Jenkins,Node: Job Submission Phase
Jenkins->>Slurm: sbatch (submit job)
Slurm-->>Jenkins: jobid
Jenkins->>Node: write jobid to slurm_job_id.txt
Jenkins->>Node: copy bash_utils.sh
end
rect rgb(245, 245, 220)
note over Jenkins,Sacct: Status Polling Phase (with Retries)
Jenkins->>Sacct: sacct --job=jobid (attempt 1)
alt Sacct delayed/unavailable
Sacct-->>Jenkins: no status
Jenkins->>Jenkins: wait 10s
Jenkins->>Sacct: sacct --job=jobid (attempt 2)
else Status available
Sacct-->>Jenkins: STATUS, EXIT_CODE
end
end
rect rgb(240, 255, 240)
note over Jenkins,Node: Exit Code Aggregation Phase
Node->>Node: pytest phase (capture exit_code_1)
Node->>Node: perf check phase (capture exit_code_2)
Node->>Node: perf sanity phase (capture exit_code_3)
Node->>Node: final_exit_code = sum(exit_codes)
Node->>Node: exit(final_exit_code)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
jenkins/L0_Test.groovy (1)
697-703: Simplify enum comparison by removing unnecessary.toString()calls.The code uses
cluster.containerRuntimedirectly as a map key inSlurmConfig.containerRuntimeToEntrypoint[cluster.containerRuntime]but then applies.toString()for string comparisons elsewhere (lines 697, 699, 863, 867, 1053). This inconsistency suggests the.toString()calls are unnecessary. For enum comparisons, directly compare against the enum constant:if (cluster.containerRuntime == ContainerRuntime.DOCKER) { // ... } else if (cluster.containerRuntime == ContainerRuntime.ENROOT) { // ... }This is more idiomatic, type-safe, and aligns with how the field is already used elsewhere in the code.
🧹 Nitpick comments (2)
jenkins/scripts/slurm_run.sh (2)
66-68: Consider adding a timeout or verification for the coverage config file.The 10-second sleep assumes the coverage config file will be ready within that time. Consider adding verification to ensure the file exists before proceeding:
🔎 Suggested improvement with file verification
else - # Sleep 10 seconds to wait for the coverage config file to be saved - sleep 10 + # Wait for the coverage config file to be saved + for i in {1..30}; do + if [ -f "$coverageConfigFile" ]; then + echo "Coverage config file found after ${i} seconds" + break + fi + sleep 1 + done + if [ ! -f "$coverageConfigFile" ]; then + echo "Warning: Coverage config file not found after 30 seconds" + fi fi
99-141: Exit code aggregation logic is sound but could be more robust.The approach of turning off
set -eand aggregating exit codes is correct for tracking failures across multiple phases. The use of addition for aggregation is practical, though non-zero exit codes could theoretically add up in unexpected ways.If you want more robust exit code handling, consider using bitwise OR or taking the maximum:
# Alternative 1: Use bitwise OR final_exit_code=$((pytest_exit_code | perf_check_exit_code | perf_sanity_check_exit_code)) # Alternative 2: Take the maximum (preserves specific error codes) final_exit_code=$pytest_exit_code [ $perf_check_exit_code -gt $final_exit_code ] && final_exit_code=$perf_check_exit_code [ $perf_sanity_check_exit_code -gt $final_exit_code ] && final_exit_code=$perf_sanity_check_exit_codeHowever, the current approach is clear and sufficient for detecting any failures (non-zero exit code).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
jenkins/L0_Test.groovyjenkins/scripts/bash_utils.shjenkins/scripts/slurm_install.shjenkins/scripts/slurm_run.sh
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: venkywonka
Repo: NVIDIA/TensorRT-LLM PR: 6029
File: .github/pull_request_template.md:45-53
Timestamp: 2025-08-27T17:50:13.264Z
Learning: For PR templates in TensorRT-LLM, avoid suggesting changes that would increase developer overhead, such as converting plain bullets to mandatory checkboxes. The team prefers guidance-style bullets that don't require explicit interaction to reduce friction in the PR creation process.
📚 Learning: 2025-08-22T19:08:10.822Z
Learnt from: yuanjingx87
Repo: NVIDIA/TensorRT-LLM PR: 7176
File: jenkins/L0_Test.groovy:361-389
Timestamp: 2025-08-22T19:08:10.822Z
Learning: In Slurm job monitoring scripts, when jobs have built-in timeouts configured (via --time parameter or partition/system timeouts), an additional timeout mechanism in the monitoring loop is typically unnecessary. When a Slurm job times out, it gets terminated and removed from the active queue, causing `squeue -j $jobId` to return non-zero and break monitoring loops naturally. The job's final status can then be checked via `sacct` to determine if it failed due to timeout.
Applied to files:
jenkins/L0_Test.groovy
🧬 Code graph analysis (1)
jenkins/scripts/slurm_install.sh (1)
jenkins/scripts/bash_utils.sh (1)
retry_command(11-45)
🪛 Shellcheck (0.11.0)
jenkins/scripts/slurm_install.sh
[warning] 9-9: ShellCheck can't follow non-constant source. Use a directive to specify location.
(SC1090)
[warning] 12-12: resourcePathNode is referenced but not assigned.
(SC2154)
[warning] 16-16: llmTarfile is referenced but not assigned.
(SC2154)
[warning] 16-16: tarName is referenced but not assigned.
(SC2154)
[warning] 21-21: pytestCommand is referenced but not assigned.
(SC2154)
jenkins/scripts/slurm_run.sh
[warning] 134-134: jobWorkspace is referenced but not assigned.
(SC2154)
⏰ 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 (6)
jenkins/scripts/bash_utils.sh (1)
11-45: LGTM! Well-implemented retry utility function.The
retry_commandfunction is cleanly implemented with:
- Clear documentation and usage examples
- Flexible parameter handling (optional max_retries and interval)
- Proper exit code propagation
- Informative error messages
This will significantly improve the reliability of Slurm installation and setup operations.
jenkins/scripts/slurm_install.sh (2)
7-9: Verify the dynamic path construction for bash_utils.sh.The path computation using
sedto replaceslurm_install.shwithbash_utils.shis clever, but ensure that:
- Both scripts are always in the same directory
- The script name exactly matches
slurm_install.shConsider documenting this path dependency or using a simpler approach:
# Alternative: Use dirname to compute the path bashUtilsPath="$(dirname "${BASH_SOURCE[0]}")/bash_utils.sh" source "$bashUtilsPath"
24-25: No action needed—exit code propagation and variable handling are working correctly.The use of
bash -cwithretry_commandhere is properly implemented. Exit codes are correctly propagated through the subshell toretry_command(verified:false && echoreturns exit code 1), and variables like$llmSrcNodeand$resourcePathNodeare expanded by the parent shell before being passed tobash -c, ensuring they resolve correctly without requiring environment variable inheritance.jenkins/L0_Test.groovy (3)
961-968: Good addition of bash_utils.sh transfer to remote node.The explicit copying of bash_utils.sh to the remote Slurm node is properly implemented with:
- Clear logging of the script contents
- Proper path variables (scriptBashUtilsLocalPath, scriptBashUtilsPathNode)
- Transfer with execute permissions (true parameter)
This ensures the retry functionality is available during Slurm job execution.
1244-1265: Excellent retry logic for handling delayed sacct updates.The retry loop for fetching STATUS and EXIT_CODE is well-implemented:
- Retries up to 3 times with 10-second intervals
- Provides clear feedback on retry attempts
- Falls back to sensible defaults (EXIT_CODE=1, STATUS="UNKNOWN") on failure
- Handles the common issue of delayed sacct database updates
This significantly improves reliability when querying Slurm job results.
1230-1234: Improved error handling and job ID persistence.The enhancements include:
- Line 1230: More specific error message when job ID is missing
- Line 1233: Clearer success message with "Slurm job" terminology
- Line 1234: Persistent job ID storage in
slurm_job_id.txtThese changes improve debugging and traceability of Slurm jobs.
|
/bot run --disable-fail-fast |
|
PR_Github #30054 [ run ] triggered by Bot. Commit: |
|
PR_Github #30054 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #30063 [ run ] triggered by Bot. Commit: |
|
PR_Github #30063 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #30074 [ run ] triggered by Bot. Commit: |
Signed-off-by: Yanchao Lu <[email protected]>
|
PR_Github #30074 [ run ] completed with state |
de2ea25 to
772af16
Compare
|
/bot run --stage-list "GB200-4_GPUs-PyTorch-1, GB200-8_GPUs-2_Nodes-PyTorch-1, DGX_B200-4_GPUs-PyTorch-1" --disable-fail-fast |
|
PR_Github #30078 [ run ] triggered by Bot. Commit: |
|
PR_Github #30078 [ run ] completed with state |
|
/bot reuse-pipeline |
|
PR_Github #30081 [ reuse-pipeline ] triggered by Bot. Commit: |
|
PR_Github #30081 [ reuse-pipeline ] completed with state |
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.
Description
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.