Repository navigation
feat(validator): GKE NCCL preflight + launcher failure mitigations - #1631
Conversation
The GKE H100 NCCL all-reduce check could fail with an opaque "pod failed" when the launcher mpirun could not reach the worker pods on freshly provisioned nodes. Three mitigations: - Add a GKE GPUDirect-TCPXO readiness preflight. A per-node probe verifies the nccl-tcpxo-installer artifact (nccl-env-profile.sh) is present before the TrainJob runs, failing fast with the unready nodes named and a fix hint, instead of an opaque launcher failure minutes later. - Widen the launcher SSH retry budget (ConnectTimeout=10, ConnectionAttempts=60) so a slow worker bring-up (runtime apt-get plus sourcing the TCPXO env profile) is tolerated rather than aborting mpirun. Matches the existing RoCE/EKS template's rationale. - Surface worker pod diagnostics (phase, container states, node and tcpxo-daemon logs) on launcher failure, and stop discarding the launcher log-fetch error, so the true cause appears in the check output. Extract the shared per-node preflight fan-out (runPerNodeProbe) so the new TCPXO preflight and the existing NVreg preflight share one implementation. Signed-off-by: Nathan Hensley <[email protected]>
📝 WalkthroughWalkthroughThis PR adds a GKE TCPXO readiness preflight for NCCL all-reduce validation, introduces a shared per-node probe helper reused by the NVreg preflight, extends launcher-failure diagnostics with NCCL worker pod details, updates worker job name matching to use a new constant, switches selected container commands to Estimated code review effort: 4 (Complex) | ~45 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@validators/performance/nccl_all_reduce_bw_constraint.go`:
- Line 1221: In collectNCCLWorkerDiagnostics, the pod selector still hardcodes
the replicated job name as "node" instead of using nodeJobName, which can drift
from the actual worker name and break diagnostics lookup. Update the selector
string to reference nodeJobName the same way the other selectors in this file
do, so the jobset.sigs.k8s.io/replicatedjob-name filter stays aligned with the
shared constant and continues finding worker pods correctly.
- Around line 1208-1267: The NCCL worker diagnostics helper is appending full
`node` and `tcpxo-daemon` logs from `collectNCCLWorkerDiagnostics`, which can
make failure payloads huge and memory-heavy. Update the log capture path around
`k8spod.GetPodLogs` to cap each container’s output before writing to the
`strings.Builder`, either by keeping only the last N lines or enforcing a byte
limit. Make sure the truncation happens per container and still preserves the
existing pod/container context in the returned diagnostics string.
In `@validators/performance/nccl_preflight_tcpxo_test.go`:
- Around line 66-128: `TestCollectNCCLWorkerDiagnostics` currently uses separate
`t.Run` blocks for two distinct cases; refactor it into a table-driven test as
requested by the test-file guidelines. Define a slice of cases covering the “no
worker pods” scenario and the “worker with failed and waiting containers”
scenario, then iterate over it with a single loop and per-case assertions
against `collectNCCLWorkerDiagnostics`. Keep the existing expectations tied to
the same symbols (`ncclTrainJobName`, `collectNCCLWorkerDiagnostics`, and the
worker pod setup) so behavior remains unchanged while the structure becomes
table-based.
In `@validators/performance/testdata/h100/gke/runtime.yaml`:
- Around line 90-96: The mpirun ssh retry settings in the runtime YAML do not
provide the intended long wait, because the ConnectTimeout and
ConnectionAttempts options only create a short ceiling. Update the worker launch
flow to use an explicit readiness check or retry/backoff wrapper before invoking
mpirun, and adjust the ssh options in the launcher configuration so the behavior
is tied to actual sshd readiness rather than relying on the current -o
StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=60
combination.
🪄 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: ASSERTIVE
Plan: Enterprise
Run ID: 2c4db787-d409-44f5-8de5-27f1ccfd11eb
📒 Files selected for processing (8)
validators/performance/consts.govalidators/performance/inference_perf_constraint.govalidators/performance/nccl_all_reduce_bw_constraint.govalidators/performance/nccl_preflight.govalidators/performance/nccl_preflight_nvreg.govalidators/performance/nccl_preflight_tcpxo.govalidators/performance/nccl_preflight_tcpxo_test.govalidators/performance/testdata/h100/gke/runtime.yaml
- Cap worker diagnostics logs to the last 100 lines per container (tailLines) so a verbose NCCL/apt-get worker cannot balloon the failure payload; the tail carries the fatal error. - Use the nodeJobName constant in the worker-pod label selector instead of a hardcoded "node", keeping the diagnostics lookup in sync with the shared constant. - Correct the launcher SSH retry budget: a refused port retries ~1s apart (ConnectTimeout only bounds the unreachable-IP case), so ConnectionAttempts is a per-second ceiling. Raise it 60 -> 300 (~5 min) and fix the comment arithmetic so the budget matches the intended fresh-node bring-up window. - Refactor TestCollectNCCLWorkerDiagnostics into a table-driven test. Signed-off-by: Nathan Hensley <[email protected]>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
validators/performance/nccl_all_reduce_bw_constraint.go (2)
1246-1288: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winSequential per-pod/per-container log fetches share one deadline — later workers can silently lose diagnostics on larger jobs.
diagCtxhas a singledefaults.DiagnosticTimeoutbudget for the entire loop (list + N pods × 2 containers ofGetPodLogs). On a large NCCL job (many worker nodes), sequential fetches can exhaust that budget before reaching later pods, so those workers would just show "logs unavailable: context deadline exceeded" — degrading exactly the diagnostics this PR is meant to strengthen for larger clusters. This PR stack already introduces a bounded-concurrencyrunPerNodeProbehelper for per-node fan-out elsewhere; reusing that pattern (or a lightweight bounded worker pool) here would let all pods get a fair shot within the timeout.🤖 Prompt for 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. In `@validators/performance/nccl_all_reduce_bw_constraint.go` around lines 1246 - 1288, The per-pod/per-container log collection in the NCCL diagnostics loop is using one shared deadline, so later pods can run out of time and lose logs on larger jobs. Update the log-fetching logic in the diagnostics block that iterates over pods and calls k8spod.GetPodLogs to use bounded concurrency or the existing per-node fan-out pattern instead of strict sequential fetches. Keep the overall timeout budget, but ensure each worker pod and its containers get a fair chance to retrieve diagnostics before the deadline.
1181-1194: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winLauncher logs are still unbounded even though worker diagnostics are now capped.
The worker diagnostics path (Line 1284) tails each container's logs to
maxDiagLogLinesspecifically to avoid ballooning the failure payload, but the launcher log fetch at Line 1189 (podHelper.GetPodLogs(ctx.Ctx, launcherPod)) still returns the full, untrimmed log stream beforelogs += collectNCCLWorkerDiagnostics(...)appends more content on top. A verbose launcher (mpirun with NCCL debug output) can still produce an oversized failure string, reintroducing the same class of issue previously flagged for worker logs.♻️ Proposed fix to tail launcher logs consistently
logs, logErr := podHelper.GetPodLogs(ctx.Ctx, launcherPod) if logErr != nil { slog.Warn("failed to retrieve launcher pod logs", "pod", launcherPod.Name, "error", logErr) logs = fmt.Sprintf("<launcher logs unavailable: %v>\n", logErr) + } else { + logs = tailLines(strings.TrimSpace(logs), maxDiagLogLines) }🤖 Prompt for 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. In `@validators/performance/nccl_all_reduce_bw_constraint.go` around lines 1181 - 1194, The launcher log path is still returning the full log stream, so the failure payload can grow without bound even though worker diagnostics are capped. Update the launcher log retrieval in the pod-failure handling block around podHelper.GetPodLogs and collectNCCLWorkerDiagnostics to apply the same tailing/line limit used for worker diagnostics, and keep the warning/error fallback behavior when logs cannot be fetched. Use the existing maxDiagLogLines pattern (or equivalent helper) so the launcher output is consistently bounded before it is appended to the returned logs.
🤖 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.
Outside diff comments:
In `@validators/performance/nccl_all_reduce_bw_constraint.go`:
- Around line 1246-1288: The per-pod/per-container log collection in the NCCL
diagnostics loop is using one shared deadline, so later pods can run out of time
and lose logs on larger jobs. Update the log-fetching logic in the diagnostics
block that iterates over pods and calls k8spod.GetPodLogs to use bounded
concurrency or the existing per-node fan-out pattern instead of strict
sequential fetches. Keep the overall timeout budget, but ensure each worker pod
and its containers get a fair chance to retrieve diagnostics before the
deadline.
- Around line 1181-1194: The launcher log path is still returning the full log
stream, so the failure payload can grow without bound even though worker
diagnostics are capped. Update the launcher log retrieval in the pod-failure
handling block around podHelper.GetPodLogs and collectNCCLWorkerDiagnostics to
apply the same tailing/line limit used for worker diagnostics, and keep the
warning/error fallback behavior when logs cannot be fetched. Use the existing
maxDiagLogLines pattern (or equivalent helper) so the launcher output is
consistently bounded before it is appended to the returned logs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 3ce28cf0-c7ca-44f4-8aab-7abd7b193b7b
📒 Files selected for processing (3)
validators/performance/nccl_all_reduce_bw_constraint.govalidators/performance/nccl_preflight_tcpxo_test.govalidators/performance/testdata/h100/gke/runtime.yaml
Follow-up to CodeRabbit's outside-diff review comments: - Tail the launcher pod logs to maxDiagLogLines as well, so a verbose mpirun/NCCL launcher can't balloon the failure payload — matching the cap already applied to worker diagnostics. - Fetch per-worker diagnostics concurrently with bounded concurrency (errgroup + preflightNodeConcurrency, order preserved via an indexed slice) instead of sequentially sharing one DiagnosticTimeout, so later workers on a large job aren't starved of the budget. Extracted the per-pod rendering into workerPodDiagnostics. - Add a table-driven TestTailLines. Signed-off-by: Nathan Hensley <[email protected]>
|
Addressed both outside-diff-range comments in 696551d:
|
mchmarny
left a comment
There was a problem hiding this comment.
Adds a GKE/H100 TCPXO readiness preflight, widens the launcher SSH retry budget, and surfaces worker-pod diagnostics on launcher failure — all confined to the NCCL check path. Overall this is well done: the runPerNodeProbe extraction is a clean dedup of the NVreg fan-out, the probe correctly distinguishes not-ready from infrastructure errors (marker-on-stdout is a nice touch), and the new diagnostics are unit-tested. CI is fully green.
Nothing blocking. One medium item (unset HostPath type can turn the "installer never ran" case — the exact scenario the preflight targets — into a 2-minute ErrCodeInternal timeout instead of a not-ready report), plus a cross-platform noise issue in the worker diagnostics and two nits. Also: branch is behind main — rebase before merge, and the PR body's ConnectionAttempts=60 is stale vs. the actual 300.
| // Cleanup runs on an independent context so it fires even when the probe | ||
| // context has been canceled (timeout, parallel-sibling error). | ||
| defer func() { //nolint:contextcheck // Fresh context: parent may be canceled during cleanup | ||
| cleanupCtx, cancel := context.WithTimeout(context.Background(), defaults.PreflightCleanupTimeout) |
There was a problem hiding this comment.
The HostPath volume has no explicit Type. If /home/kubernetes/bin/nvidia doesn't exist at all on a node (installer DaemonSet never ran — arguably the strongest form of the condition this preflight exists to catch), the empty type leaves behavior runtime-dependent: some runtimes create a root-owned dir (probe then correctly reports not-ready), others fail the mount and leave the pod stuck in ContainerCreating until the 2-minute DiagnosticTimeout expires — which then aborts the whole fan-out as ErrCodeInternal ("probe failed") instead of naming the node as not-ready.
Consider an explicit Type: &hostPathDirectoryOrCreate (matches what containerd does implicitly, and the dir is harmless — the installer owns its contents), or mount a guaranteed-existing parent like /home/kubernetes/bin and test the full relative path.
There was a problem hiding this comment.
Fixed in 1041ab1 — the probe HostPath now sets Type: DirectoryOrCreate. That makes the installer-never-ran case deterministic: the dir is created empty, test -f reports not-ready, and the node is named in the fail-fast error instead of the probe hanging in ContainerCreating until DiagnosticTimeout. The empty dir is harmless (the installer owns and populates its contents).
| // GetPodLogs streams the full log — a verbose NCCL/apt-get worker can emit | ||
| // thousands of lines — so tail each container to the last maxDiagLogLines | ||
| // before appending, keeping the failure payload bounded. The tail (not the | ||
| // head) is kept because the fatal error is almost always the last output. |
There was a problem hiding this comment.
collectNCCLWorkerDiagnostics runs on every platform's launcher-failure path (EKS, OKE, ...), but the container list here hardcodes tcpxo-daemon, which only exists in the GKE template. On non-GKE failures every worker gets a noise line: [tcpxo-daemon logs unavailable: container "tcpxo-daemon" not found ...].
Consider deriving the container names from p.Spec.InitContainers/p.Spec.Containers instead — it removes the noise and also stays correct if a template renames its sidecar.
There was a problem hiding this comment.
Fixed in 1041ab1 — workerPodDiagnostics now derives container names from p.Spec.InitContainers + p.Spec.Containers rather than hardcoding [node, tcpxo-daemon]. No more spurious "container not found" line on EKS/OKE, and a renamed sidecar still gets its logs captured.
| # refusal), making the real ceiling ~= ConnectionAttempts | ||
| # seconds. Size it to ~5 min so a slow worker bring-up retries | ||
| # instead of aborting the launcher. | ||
| - -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=300 |
There was a problem hiding this comment.
Two things here:
-
The comment's "~ConnectionAttempts seconds" ceiling only holds for the connection-refused case. For an unreachable IP (worker pod never scheduled, network policy drop) each attempt burns the full
ConnectTimeout=10, so the worst case is ~300 × 11s ≈ 55 min — pastNCCLTrainJobTimeout(30 min), meaning that path fails as a wait-timeout rather than an mpirun abort. Not wrong (the outer timeout still bounds it), but worth a sentence in the comment so nobody "fixes" the timeout interplay later. -
nit: the PR description says
ConnectionAttempts=60 (~10-min)— stale vs. the actual300here; update the body before merge.
There was a problem hiding this comment.
Both addressed in 1041ab1: expanded the comment to spell out the unreachable-IP case (each attempt burns the full ConnectTimeout, worst case ~55 min, but bounded by the outer NCCLTrainJobTimeout and surfacing as a wait-timeout, with a note to keep the two timeouts in mind together), and corrected the stale 60 (~10-min) in the PR description to 300 (~5-min).
| // sequential per-pod log fetches would share the single DiagnosticTimeout, | ||
| // so on a large job later workers could exhaust it and lose diagnostics. | ||
| // Order is preserved via an indexed result slice; workerPodDiagnostics is | ||
| // best-effort and never errors, so g.Wait never cancels the group early. |
There was a problem hiding this comment.
nit: preflightNodeConcurrency is documented (and named) as a cap on in-flight probe Pods creating scheduler pressure; here it's reused to bound log fetches, which are much cheaper apiserver reads. Fine to share the value, but a locally named constant (or a rename to something like perNodeFanoutConcurrency) would keep the doc comment honest.
There was a problem hiding this comment.
Renamed to perNodeFanoutConcurrency in 1041ab1 and generalized its doc to say it bounds both preflight probe Pods and diagnostics log fetches — so the name and comment now match both use sites.
Address maintainer review: - TCPXO preflight HostPath now uses DirectoryOrCreate. The exact condition the preflight targets (installer never ran, dir absent) previously had runtime-dependent mount behavior that could hang the probe pod in ContainerCreating until DiagnosticTimeout and abort the fan-out as an internal error instead of reporting the node not-ready. - Worker diagnostics derive container names from the pod spec instead of a hardcoded [node, tcpxo-daemon], so non-GKE launcher failures no longer emit a spurious "container not found" line and renamed sidecars still get logged. - Rename preflightNodeConcurrency -> perNodeFanoutConcurrency and generalize its doc: it now bounds both preflight probe Pods and diagnostics log fetches. - Expand the launcher SSH-retry comment to cover the unreachable-IP case (full ConnectTimeout per attempt, bounded by the outer NCCLTrainJobTimeout). Signed-off-by: Nathan Hensley <[email protected]>
…VIDIA#1631) Signed-off-by: Nathan Hensley <[email protected]>
Summary
Add a GKE GPUDirect-TCPXO readiness preflight to the NCCL all-reduce check, widen the launcher's SSH retry budget, and surface worker-pod diagnostics on launcher failure — so a GKE/H100 run that currently dies with an opaque "pod failed" fails fast and legibly (or tolerates slow worker bring-up) instead.
Motivation / Context
On GKE H100, the
nccl-all-reduce-bwcheck applies a Kubeflow TrainJob whose launchermpirunSSHes to worker pods. On freshly provisioned UAT nodes two things race the launcher: (1) the worker containers installopenssh-serverand source the TCPXO env profile at container start before sshd comes up, and (2) thenccl-tcpxo-installerDaemonSet may not have laid downnccl-env-profile.sh/ FastRak libs yet. Either causesmpirunto exhaust its SSH connection attempts and the launcher pod to enterFailed. The check then reports onlypod failedbecause the launcher log-fetch error was discarded and no worker context was gathered — making root-cause impossible after the fact.Fixes: N/A
Related: N/A
Type of Change
Component(s) Affected
pkg/validator) — specifically the standalonevalidators/performanceNCCL check binaryImplementation Notes
nccl_preflight_tcpxo.go):gkeTCPXOPreflightAppliesgates ondefault variant + GKE + H100;preflightGKETCPXOReadyfans out a per-node busybox probe that checks for/home/kubernetes/bin/nvidia/lib64/nccl-env-profile.sh(the exact artifact the worker startup chain sources). Missing →ErrCodeInvalidRequestnaming the unready nodes with a fix hint. Modeled on the existing GB200 NVreg preflight.testdata/h100/gke/runtime.yaml):ConnectionAttempts=10→-o ConnectTimeout=10 -o ConnectionAttempts=300(~5-min bounded reachability; refused-port retries are ~1s apart, so the ceiling ≈ attempts, and the outer NCCLTrainJobTimeout bounds the unreachable-IP case). Mirrors the rationale already present in the EKS template.nccl_all_reduce_bw_constraint.go):waitForLauncherPodAndGetLogsno longer discards the launcher log-fetch error and, on failure, appendscollectNCCLWorkerDiagnostics(per-worker phase, container terminated/waiting reason + exit code + message, and best-effortnode/tcpxo-daemonlogs).runPerNodeProbe(nccl_preflight.go) so the new TCPXO preflight and the existing NVreg preflight share one implementation; addedshellBin/nodeJobNameconstants.Testing
TestGKETCPXOPreflightApplies(gate matrix) andTestCollectNCCLWorkerDiagnostics(no-pods + failed/waiting container states).validators/performance39.4% → 39.6% (+0.2%).TrainingRuntimeafter the edit.make qualifylocally; relying on CI for the module-wide gate.Risk Assessment
Rollout notes: N/A — no config, API, or recipe surface changes; behavior change is confined to the
nccl-all-reduce-bwvalidator on GKE/H100.Checklist
make testwith-race) — affected package run with-racemake lint) —golangci-linton affected package, 0 issuesgit commit -S)