Skip to content

[TRTLLMINF-40][fix] Introduce a SLURM dispatcher pod "finalizer"#16446

Open
dpitman-nvda wants to merge 7 commits into
NVIDIA:mainfrom
dpitman-nvda:fix/slurm-dispatcher-pod-death-finalizer
Open

[TRTLLMINF-40][fix] Introduce a SLURM dispatcher pod "finalizer"#16446
dpitman-nvda wants to merge 7 commits into
NVIDIA:mainfrom
dpitman-nvda:fix/slurm-dispatcher-pod-death-finalizer

Conversation

@dpitman-nvda

@dpitman-nvda dpitman-nvda commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Prevented leaked SLURM jobs and Jenkins agent nodes when Kubernetes dispatcher pods fail unexpectedly.
    • Added automatic recovery and cleanup for orphaned resources after pod failures or interrupted runs.
    • Improved retry handling so failed dispatcher pods are reconciled safely instead of retried in place.
    • Added a final post-build cleanup sweep to catch resources missed during execution.

Description

If a k8s pod managing a SLURM job dies, the existing retry logic will attempt to reuse that pod and will inevitably fail, which wastes the retry logic. What's more, the cleanup logic also relies on this dead pod, meaning we leak resources to boot.

This PR introduces SLURM management state outside of the code that runs inside the dispatcher pod. The SLURM information (cluster, node, Job ID, submission method) is registered once the pod knows about it. If the pod completes successfully, the resource is deregistered.

At the end of the run, the finalizer routine checks if any SLURM resources are still registered and cleans them up.

NB: we do not attempt a rerun or reattachment of the stage. That is coming in a follow-up.

Test Coverage

N/A, this is a CI change

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)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • 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

To see a list of available CI bot commands, please comment /bot help.

…er pod

When the K8s dispatcher pod dies mid-run (kubelet eviction, container
termination, agent offline), the inner SLURM retry classified the wrapped
"marked offline" as a transient infra failure and started another attempt --
which then executes on the same dead pod and fails immediately, spamming
AgentOfflineException and burning the retry budget for nothing.

Detect a dispatcher-pod death from the flattened cause chain (robust to the
cleanup AbortException that wraps it) and fail closed instead of retrying in
place. This is the first half of dispatcher-pod-death handling; off-pod
reconciliation of the orphaned SLURM job / Jenkins node follows.

Signed-off-by: Derek Pitman <dpitman@nvidia.com>
…d death

When a SLURM dispatcher pod dies mid-run, its in-pod cleanup can no longer
reach the login node, so the SLURM job and any Jenkins agent node leak (every
"Clean Up Slurm Resource" retry fails with AgentOfflineException against the
dead pod, right up to End of Pipeline).

Add a build-scoped registry (keyed by stageName) of live SLURM resources: the
pod wrapper records the dispatcher pod spec, the stage body records the SLURM
job / Jenkins node identity, and the normal cleanup path deregisters once the
resources are actually torn down. Only serializable primitives are stored (the
SlurmCluster is rebuilt from clusterName) so pipeline persistence is unaffected.

On a dispatcher-pod death (runnerStarted, isDispatcherPodFailure) the pod
wrapper -- now back on the parent context -- launches a fresh cleanup pod and
runs the normal scancel/workspace-clean/destroyNode off-pod. A post-build sweep
backstops anything the in-catch finalize missed or failed on. Best-effort
throughout: a finalizer failure is logged and never masks the stage failure.

Together with the fail-closed change, this stops the leak the retry-on-a-dead-
pod behavior left behind. Runtime paths (fresh-pod launch inside the catch /
post-build finally, @field registry) need CI validation.

Signed-off-by: Derek Pitman <dpitman@nvidia.com>
@dpitman-nvda
dpitman-nvda requested a review from a team as a code owner July 15, 2026 19:00
@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Jenkins pipeline adds a concurrent SLURM resource registry, off-pod cleanup after dispatcher pod failures, failure-aware retry handling, dispatcher integration across x86 and SBSA paths, and a post-build orphan sweep.

Changes

SLURM reconciliation

Layer / File(s) Summary
Registry and off-pod finalization
jenkins/L0_Test.groovy
Tracks stage resources, launches cleanup pods, deregisters completed entries, and sweeps remaining orphans.
SLURM resource lifecycle tracking
jenkins/L0_Test.groovy
Registers agent and sbatch resource identities after capture and removes them after normal cleanup.
Dispatcher failure handling
jenkins/L0_Test.groovy
Classifies dispatcher failures, stops in-place retries, and enables off-pod finalization for x86 and SBSA dispatcher paths.
Post-build orphan sweep
jenkins/L0_Test.groovy
Runs a best-effort orphan sweep from the Test stage’s finally block.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DispatcherPod
  participant JenkinsPipeline
  participant SLURMRegistry
  participant CleanupPod
  DispatcherPod->>JenkinsPipeline: fail during SLURM execution
  JenkinsPipeline->>SLURMRegistry: retrieve registered stage resources
  JenkinsPipeline->>CleanupPod: run SLURM or node cleanup
  CleanupPod->>SLURMRegistry: deregister cleaned resources
  JenkinsPipeline->>JenkinsPipeline: sweep remaining entries in Test finally
Loading

Suggested reviewers: emmaqiaoch, tburt-nv, yiqingy0

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required ticket/type/summary pattern and accurately names the SLURM dispatcher finalizer change.
Description check ✅ Passed The description includes the issue, solution, test coverage, and checklist sections, so it is mostly complete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@jenkins/L0_Test.groovy`:
- Around line 4614-4622: Pass the in-scope attemptPodSpec as the pod-spec
override when calling finalizeOrphanedSlurmResource from the dispatcher-pod
failure branch in runLLMTestlistOnSlurm. Keep the existing failure handling
unchanged while ensuring finalizeSlurmResourceEntry can launch cleanup for later
SLURM attempts after prior cleanup removed the registry entry.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0eafc435-524c-45ea-9505-5dc98ee693ad

📥 Commits

Reviewing files that changed from the base of the PR and between 287c12a and 8419d0b.

📒 Files selected for processing (1)
  • jenkins/L0_Test.groovy

Comment thread jenkins/L0_Test.groovy
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59513 [ run ] triggered by Bot. Commit: 8419d0b Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59513 [ run ] completed with state FAILURE. Commit: 8419d0b
/LLM/main/L0_MergeRequest_PR pipeline #47969 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

… wipe

Two fixes to the off-pod reconciliation registry:

- The Jenkins script sandbox forbids `new java.util.concurrent.ConcurrentHashMap`
  ("Scripts not permitted to use ..."), which failed the pipeline at load. Use
  plain map literals: pipeline Groovy runs single-threaded under CPS (parallel
  branches interleave at step boundaries, never execute Groovy concurrently) and
  each stage writes its own key, so there is no concurrent map corruption to
  guard against.

- deregisterSlurmResource removed the whole entry, but podSpec is registered
  only once (before the inner SLURM retry loop). After the first attempt's
  cleanup deregistered, a later attempt's dispatcher-pod death had no podSpec to
  launch a cleanup pod with, and the post-build sweep could not recover it
  either. Deregister now clears only the per-attempt job/node identity and keeps
  the stage-level podSpec, so both the in-catch finalize and the sweep can always
  reconcile. An entry left with only a podSpec is inert (finalize and the sweep
  skip entries with no job/node).

Signed-off-by: Derek Pitman <dpitman@nvidia.com>
@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59517 [ run ] triggered by Bot. Commit: 5c41011 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59517 [ run ] completed with state SUCCESS. Commit: 5c41011
/LLM/main/L0_MergeRequest_PR pipeline #47971 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59720 [ run ] triggered by Bot. Commit: 5c41011 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59720 [ run ] completed with state SUCCESS. Commit: 5c41011
/LLM/main/L0_MergeRequest_PR pipeline #48146 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59741 [ run ] triggered by Bot. Commit: 2613082 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59741 [ run ] completed with state FAILURE. Commit: 2613082
/LLM/main/L0_MergeRequest_PR pipeline #48169 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59773 [ run ] triggered by Bot. Commit: 2613082 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59773 [ run ] completed with state SUCCESS. Commit: 2613082
/LLM/main/L0_MergeRequest_PR pipeline #48198 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60007 [ run ] triggered by Bot. Commit: 2613082 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60007 [ run ] completed with state FAILURE. Commit: 2613082
/LLM/main/L0_MergeRequest_PR pipeline #48398 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60026 [ run ] triggered by Bot. Commit: 2613082 Link to invocation

…pod-death-finalizer

Signed-off-by: Derek Pitman <dpitman@nvidia.com>

# Conflicts:
#	jenkins/L0_Test.groovy
…ndentation

- runLLMTestlistOnSlurm dispatcher-pod-failure branch now passes the in-scope
  attemptPodSpec to finalizeOrphanedSlurmResource, so the off-pod finalizer never
  depends on the registry entry's podSpec surviving a prior attempt's deregister
  (CodeRabbit).
- Re-indent the Test-stage body wrapped by the post-build sweep try/finally
  (chzblych).

Signed-off-by: Derek Pitman <dpitman@nvidia.com>
@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60766 [ run ] triggered by Bot. Commit: b675f87 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60766 [ run ] completed with state FAILURE. Commit: b675f87
/LLM/main/L0_MergeRequest_PR pipeline #49049 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60989 [ run ] triggered by Bot. Commit: b675f87 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60989 [ run ] completed with state FAILURE. Commit: b675f87
/LLM/main/L0_MergeRequest_PR pipeline #49251 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61048 [ run ] triggered by Bot. Commit: b675f87 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61048 [ run ] completed with state FAILURE. Commit: b675f87
/LLM/main/L0_MergeRequest_PR pipeline #49304 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61083 [ run ] triggered by Bot. Commit: b675f87 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61083 [ run ] completed with state SUCCESS. Commit: b675f87
/LLM/main/L0_MergeRequest_PR pipeline #49337 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61107 [ run ] triggered by Bot. Commit: b675f87 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61107 [ run ] completed with state SUCCESS. Commit: b675f87
/LLM/main/L0_MergeRequest_PR pipeline #49361 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61299 [ run ] triggered by Bot. Commit: b675f87 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61299 [ run ] completed with state FAILURE. Commit: b675f87
/LLM/main/L0_MergeRequest_PR pipeline #49532 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61322 [ run ] triggered by Bot. Commit: b675f87 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61322 [ run ] completed with state FAILURE. Commit: b675f87
/LLM/main/L0_MergeRequest_PR pipeline #49552 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61395 [ run ] triggered by Bot. Commit: b675f87 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61395 [ run ] completed with state SUCCESS. Commit: b675f87
/LLM/main/L0_MergeRequest_PR pipeline #49622 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61416 [ run ] triggered by Bot. Commit: 367d25e Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61416 [ run ] completed with state SUCCESS. Commit: 367d25e
/LLM/main/L0_MergeRequest_PR pipeline #49642 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

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.

4 participants