Skip to content

Conversation

@yuanjingx87
Copy link
Collaborator

@yuanjingx87 yuanjingx87 commented Nov 14, 2025

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 the stage-list parameter 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.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip 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-pipeline

Reuse 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

    • Enhanced Slurm job submission and tracking with a two-stage script-based workflow for improved job completion monitoring and state management.
  • Chores

    • Streamlined job state file handling in the Slurm execution process.

@yuanjingx87 yuanjingx87 requested review from a team as code owners November 14, 2025 03:58
@yuanjingx87 yuanjingx87 requested review from niukuo and ruodil November 14, 2025 03:58
@yuanjingx87
Copy link
Collaborator Author

/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24553 [ run ] triggered by Bot. Commit: 821fb59

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

📝 Walkthrough

Walkthrough

The PR refactors Slurm job submission in jenkins/L0_Test.groovy from direct inline execution to a two-stage script-based mechanism with separate submission and tracking scripts. It removes the job ID persistence side effect from jenkins/scripts/slurm_run.sh, delegating this responsibility to the new submission workflow.

Changes

Cohort / File(s) Summary
Slurm submission refactoring
jenkins/L0_Test.groovy
Replaces direct inline Slurm SBATCH submission with a two-part flow using slurm_submit.sh and slurm_track.sh scripts. Introduces local and remote submission scripts, job ID file tracking at jobWorkspace/slurm_job_id.txt, polling-based status verification loop, and new path variables (scriptSubmitPathLocal/Node, scriptTrackPathLocal/Node) replacing previous execution paths.
Remote execution cleanup
jenkins/scripts/slurm_run.sh
Removes the side effect that persisted Slurm job ID to $jobWorkspace/slurm_job_id.txt when SLURM_LOCALID equals 0. Subsequent environment preparation logic remains unchanged.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Areas requiring extra attention:

  • Job ID lifecycle management: Verify that removal of job ID persistence from slurm_run.sh is now properly handled by the new submission script without breaking existing workflows
  • Path variable mappings: Ensure all references to scriptExecPathLocal/Node have been correctly replaced with scriptSubmitPathLocal/Node and scriptTrackPathLocal/Node
  • Polling and error handling: Review the polling-based wait loop logic for robustness, timeout handling, and proper error state propagation
  • Script synchronization: Confirm that local submission and tracking scripts are correctly copied to the remote node before execution
  • State file handling: Validate that jobWorkspace/slurm_job_id.txt is created at the correct time and is accessible by tracking logic

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lacks critical required sections: it provides only a minimal 9-word title and does not adequately explain the technical rationale, implementation details, or test coverage strategy. Expand the description to explain why the retry logic is needed, what specific SSH failures it addresses, and document the test coverage for the new retry mechanism. Complete the Test Coverage section with specific tests or scenarios.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding retry logic for retrieving Slurm sbatch job logs when SSH drops. It follows the required format with [None][infra] prefix and is specific enough.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 avoiding writeFile for generated scripts in containerized agents

You’re using pipeline.writeFile to create the new slurm_submit.sh and slurm_track.sh temp files:

pipeline.writeFile(file: scriptSubmitPathLocal, text: scriptSubmit)
...
pipeline.writeFile(file: scriptTrackPathLocal, text: scriptTrack)

We’ve previously seen Jenkins containerized agents hit permission issues with writeFile in 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

📥 Commits

Reviewing files that changed from the base of the PR and between e90dbaf and 821fb59.

📒 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 assumption

The two-stage submit/track flow is good, but has robustness gaps:

  1. SSH drops during slurm_track.sh execution can abort the stage without retry.

    • Line 1032: Utils.exec(... scriptExecPathNode) has no retry, catchError, or explicit status handling.
    • If SSH drops while tail -f or squeue runs, the stage will abort before the outer while (true) loop can retry.
  2. Double-polling via both slurm_track.sh and outer while-loop is redundant.

    • slurm_track.sh already polls squeue (line 1006), tails output, and determines final exit via sacct (line 1015).
    • The outer while (true) (lines 1034–1050) adds a second squeue-polling layer, complicating logic unnecessarily.
  3. squeue exit code behavior differs from the original concern:

    • squeue returns 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.exec call (line 1032) in a retry block 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) since slurm_track.sh is the authoritative tracking mechanism and will exit when complete.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24553 [ run ] completed with state FAILURE. Commit: 821fb59
/LLM/main/L0_MergeRequest_PR pipeline #18534 (Partly Tested) completed with status: 'FAILURE'

@yuanjingx87 yuanjingx87 force-pushed the user/yuanjingx/try_tail_slurm_log_after_ssh_drop branch from 821fb59 to 21528b7 Compare November 14, 2025 08:14
@yuanjingx87
Copy link
Collaborator Author

/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24614 [ run ] triggered by Bot. Commit: 21528b7

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24614 [ run ] completed with state FAILURE. Commit: 21528b7
/LLM/main/L0_MergeRequest_PR pipeline #18580 (Partly Tested) completed with status: 'FAILURE'

@yuanjingx87 yuanjingx87 force-pushed the user/yuanjingx/try_tail_slurm_log_after_ssh_drop branch from 21528b7 to 727b4b9 Compare November 14, 2025 22:10
@yuanjingx87
Copy link
Collaborator Author

/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24631 [ run ] triggered by Bot. Commit: 727b4b9

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24631 [ run ] completed with state FAILURE. Commit: 727b4b9
/LLM/main/L0_MergeRequest_PR pipeline #18595 (Partly Tested) completed with status: 'FAILURE'

@yuanjingx87 yuanjingx87 force-pushed the user/yuanjingx/try_tail_slurm_log_after_ssh_drop branch from 727b4b9 to 35f9d5c Compare November 14, 2025 23:27
@yuanjingx87
Copy link
Collaborator Author

/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24634 [ run ] triggered by Bot. Commit: 35f9d5c

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24634 [ run ] completed with state SUCCESS. Commit: 35f9d5c
/LLM/main/L0_MergeRequest_PR pipeline #18597 (Partly Tested) completed with status: 'FAILURE'

@yuanjingx87 yuanjingx87 marked this pull request as draft November 17, 2025 19:13
@yuanjingx87
Copy link
Collaborator Author

/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24802 [ run ] triggered by Bot. Commit: 35f9d5c

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24802 [ run ] completed with state SUCCESS. Commit: 35f9d5c
/LLM/main/L0_MergeRequest_PR pipeline #18715 (Partly Tested) completed with status: 'FAILURE'

@yuanjingx87 yuanjingx87 force-pushed the user/yuanjingx/try_tail_slurm_log_after_ssh_drop branch from 35f9d5c to c5f522d Compare November 18, 2025 18:30
@yuanjingx87
Copy link
Collaborator Author

/bot run --stage-list="DGX_B200-4_GPUs-PyTorch-Post-Merge-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24939 [ run ] triggered by Bot. Commit: c5f522d

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24939 [ run ] completed with state FAILURE. Commit: c5f522d
/LLM/main/L0_MergeRequest_PR pipeline #18838 (Partly Tested) completed with status: 'FAILURE'

@yuanjingx87 yuanjingx87 force-pushed the user/yuanjingx/try_tail_slurm_log_after_ssh_drop branch from c5f522d to 0b204ca Compare November 19, 2025 08:14
@tensorrt-cicd
Copy link
Collaborator

PR_Github #29468 [ run ] triggered by Bot. Commit: f1184bd

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29468 [ run ] completed with state SUCCESS. Commit: f1184bd
/LLM/main/L0_MergeRequest_PR pipeline #22650 (Partly Tested) completed with status: 'SUCCESS'

@yuanjingx87
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29488 [ run ] triggered by Bot. Commit: f1184bd

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29488 [ run ] completed with state SUCCESS. Commit: f1184bd
/LLM/main/L0_MergeRequest_PR pipeline #22669 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@yuanjingx87
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29549 [ run ] triggered by Bot. Commit: f1184bd

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29549 [ run ] completed with state SUCCESS. Commit: f1184bd
/LLM/main/L0_MergeRequest_PR pipeline #22722 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@yuanjingx87
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29661 [ run ] triggered by Bot. Commit: f1184bd

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29661 [ run ] completed with state DISABLED
CI server is currently disabled for scheduled maintenance. Estimated completion time: 12 PM PST on 12/23.

@yuanjingx87 yuanjingx87 force-pushed the user/yuanjingx/try_tail_slurm_log_after_ssh_drop branch from f1184bd to 08ef6c2 Compare December 30, 2025 18:29
@yuanjingx87
Copy link
Collaborator Author

/bot run —post-merge --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30198 Bot args parsing error: usage: /bot [-h]
{run,kill,skip,submit,reviewers,reuse-pipeline,reuse-review} ...
/bot: error: unrecognized arguments: —post-merge

@yuanjingx87
Copy link
Collaborator Author

/bot run --post-merge --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30202 [ run ] triggered by Bot. Commit: 08ef6c2

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30202 [ run ] completed with state FAILURE. Commit: 08ef6c2
/LLM/main/L0_MergeRequest_PR pipeline #23247 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@yuanjingx87 yuanjingx87 force-pushed the user/yuanjingx/try_tail_slurm_log_after_ssh_drop branch from 08ef6c2 to 1de3717 Compare December 31, 2025 22:14
@yuanjingx87
Copy link
Collaborator Author

/bot run

@yuanjingx87 yuanjingx87 force-pushed the user/yuanjingx/try_tail_slurm_log_after_ssh_drop branch from 1de3717 to 849402f Compare December 31, 2025 23:30
@yuanjingx87
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30305 [ run ] triggered by Bot. Commit: 849402f

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30305 [ run ] completed with state SUCCESS. Commit: 849402f
/LLM/main/L0_MergeRequest_PR pipeline #23339 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@yuanjingx87
Copy link
Collaborator Author

/bot run --stage-list="GB200-8_GPUs-2_Nodes-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30320 [ run ] triggered by Bot. Commit: 849402f

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30320 [ run ] completed with state FAILURE. Commit: 849402f
/LLM/main/L0_MergeRequest_PR pipeline #23354 (Partly Tested) completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

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.

3 participants