Skip to content

[PowerX] verify Slurm completion and normal llm-d exits / 验证 Slurm 完成与 llm-d 正常退出 - #3052

Open
edwingao28 wants to merge 5 commits into
mainfrom
fix/powerx-slurm-completion-split
Open

[PowerX] verify Slurm completion and normal llm-d exits / 验证 Slurm 完成与 llm-d 正常退出#3052
edwingao28 wants to merge 5 commits into
mainfrom
fix/powerx-slurm-completion-split

Conversation

@edwingao28

@edwingao28 edwingao28 commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Description

Check terminal allocation status using the allocation ExitCode and preserve diagnostics before returning failure. Publish llm-d completion atomically so successful workers exit normally.

Testing: Linux CPU CI: 360 passed; 51 local Slurm/lifecycle/Kimi tests and nine saved-receipt replays passed.

Pending: Actual launcher qualification and CODEOWNER sign-off.

中文

使用分配的 ExitCode 检查最终状态,并在返回失败前保留诊断。原子发布 llm-d 完成状态,使成功工作进程正常退出。

测试: Linux CPU CI 360 项通过;本地 51 项 Slurm/生命周期/Kimi 测试及 9 项既有回执回放通过。

待完成: 实际启动器资格验证和 CODEOWNER 签核。

Related Issue

Split from #3026; independent of native power collection.

拆分自 #3026;独立于原生功耗采集。

Type of Change

  • Bug fix
  • New feature
  • Configuration change
  • Documentation update
  • Other (please describe)

Checklist

  • I have tested my changes locally
  • I have updated documentation if necessary
  • For every change that can affect benchmark performance and every recipe addition or modification, I have appended a new entry to the physical end of perf-changelog.yaml and have not edited historical entries
  • Before merging via reuse, an authorized maintainer (OWNER/MEMBER/COLLABORATOR) has commented /reuse-sweep-run on this PR. Do this only once there is a final full sweep that is all green with evals passing, since after this comment the sweep label will no longer automatically kick off new sweeps. Remove and re-add the label to force one.

Note

Medium Risk
Touches Slurm job lifecycle and failure propagation across many cluster launchers and llm-d multinode benchmarks; misclassification could fail good runs or mask bad ones, but changes are heavily tested and mostly affect CI orchestration.

Overview
Adds terminal Slurm verification so benchmark launchers distinguish real COMPLETED allocations from cancellations or hidden failures. verify_slurm_job_completion in slurm_utils.sh reads sacct (with scontrol fallback), writes slurm_job_*_outcome.txt, and is wired into stream_slurm_job_log and multiple launch_*.sh scripts so logs and power artifacts are staged before the workflow exits with the verified RC.

llm-d no longer scancels the allocation when the coordinator finishes. The decode coordinator atomically publishes exit status in .bench_done.$SLURM_JOB_ID; workers poll that marker and exit with the same code, while job.slurm propagates srun failure without cancelling successful runs.

CI power audit uploads include the outcome receipts; changelog gate runs new test_llmd_lifecycle.py / Slurm utils tests; docs and perf-changelog.yaml record the behavior for several fixed-seq recipes.

Reviewed by Cursor Bugbot for commit fe3a0d4. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the contribution! Please reach out to respective companies' CODEOWNER to fill in the latest PR_REVIEW_CHECKLIST.md before pinging core maintainer on Slack for review. In order for the signoff PR check bot to trigger, you must follow the PR_REVIEW_CHECKLIST.md template correctly, including the phrase As a PR reviewer and CODEOWNER, I have reviewed this and have.

For PR verification, add the full-sweep-fail-fast label (strongly recommended) to this PR — the benchmark sweep only runs on labeled PRs. Use full-sweep-enabled only if you need matrix jobs to keep running past a failure.

PR authors are responsible for ensuring that after merging, all GitHub Action jobs fully pass. A lot of the time, failures are just flakes and simply re-running the failed jobs will fix it. See GitHub's docs on re-running failed jobs


感谢你的贡献!请联系相应公司的 CODEOWNER 填写最新的 PR_REVIEW_CHECKLIST.md,然后再在 Slack 上联系核心维护者进行审阅。为了触发 signoff PR 检查机器人,你必须正确遵循 PR_REVIEW_CHECKLIST.md 模板,包括保留英文语句 As a PR reviewer and CODEOWNER, I have reviewed this and have

如需进行 PR 验证,请为此 PR 添加 full-sweep-fail-fast 标签(强烈推荐)— 基准测试 sweep 仅在带有标签的 PR 上运行。仅当需要矩阵任务在失败后继续运行时才使用 full-sweep-enabled

PR 作者有责任确保合并后所有 GitHub Action 任务完全通过。 很多时候失败只是偶发抖动(flake),重新运行失败的任务即可解决。参见 GitHub 关于重新运行失败任务的文档

验证 Slurm 完成状态并让 llm-d 工作进程正常退出,先保存诊断证据。

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread runners/slurm_utils.sh
按完整字段解析 Slurm 分配退出码,避免误用 DerivedExitCode。
在现有 CPU 工作流中执行 llm-d 生命周期回归,并跟踪相关脚本变更。
合并 Kimi-K3 B200 前置,并保留所有路径在失败返回前的诊断采集。
将已验证的信号就绪屏障移至共享原生采集前置,避免重放 exec 前的竞态。

@claude claude 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.

I reviewed this PR and didn't find any bugs. Because it reworks how success/failure is determined for Slurm jobs and llm-d multi-node workers across every Slurm launcher, and the author's own checklist flags launcher qualification and CODEOWNER sign-off as still pending, a human look would still be worthwhile before merge.

What was reviewed: the new verify_slurm_job_completion sacct-with-scontrol-fallback logic and outcome-file recording in runners/slurm_utils.sh; the llm-d job.slurm/server.sh rework that replaces the scancel-on-marker watcher with a real exit-code marker (finish_llmd_node) and a worker polling loop; and exit-code propagation (SRT_JOB_RC/main_rc) through all 8 Slurm launcher scripts plus the new unit tests covering these paths.

Extended reasoning...

Overview

This PR changes how the InferenceX runner stack decides whether a Slurm job (and, for llm-d, its multi-node workers) truly succeeded, rather than inferring success from "left the queue" or "marker file appeared." Core additions are verify_slurm_job_completion() in runners/slurm_utils.sh (reads sacct, falls back to scontrol show job, writes a receipt file, requires exact COMPLETED/0:0), a rewrite of the llm-d job.slurm/server.sh shutdown protocol (real exit-code marker instead of scancel-on-touch, worker polling instead of wait), and propagation of the verified return code through all 8 Slurm launcher scripts. Tests (test_slurm_utils.py, new test_llmd_lifecycle.py) exercise the sacct/scontrol fallback matrix and the llm-d marker publication/consumption boundary with subprocess-level fixtures.

Security risks

No injection, auth, or data-exposure surface is introduced; this is internal CI/benchmark orchestration logic operating on trusted Slurm/CI infrastructure. The main risk class is correctness/availability (a benchmark job silently reported as failed/succeeded incorrectly), not security.

Level of scrutiny

This warrants more than a quick skim: it touches a shared bash library (slurm_utils.sh) used by every Slurm-based launcher, changes exit-code semantics that downstream CI/reporting depends on, and reworks a fragile shell IPC pattern (file-based markers, EXIT/TERM traps, SIGTERM forwarding) across coordinator/worker roles in server.sh. The PR description itself marks "Actual launcher qualification" and "CODEOWNER sign-off" as pending, which is a direct signal from the author that this hasn't been validated end-to-end on real hardware yet.

Other factors

Test coverage for the new logic is genuinely present and reasonably thorough (parametrized sacct/scontrol race scenarios, marker publish/consume ordering via a printf shim). No outstanding third-party review comments are visible in the timeline, and CODEOWNERS only lists the generic @ InferenceX/core for these paths (no specific blocking owner). Given the breadth (8 launchers + shared lib + multi-node protocol rewrite) and the author's own pending-qualification caveat, a human check-in before merge is the safer default even though the automated hunt turned up nothing actionable.

This review covers commit ec4a58f, which is no longer the latest commit on this pull request; later commits are not covered by it.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fe3a0d4. Configure here.

Comment thread runners/slurm_utils.sh
# empties. Ask the controller before judging the final outcome.
record=$(scontrol show job "$job_id" --oneliner 2>/dev/null) || record=""
state=$(printf '%s\n' "$record" | sed -n 's/.*JobState=\([^ ]*\).*/\1/p')
exit_code=$(printf '%s\n' "$record" | tr ' ' '\n' | sed -n 's/^ExitCode=//p')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

scontrol fallback drops job outcome

High Severity

The scontrol fallback runs scontrol show job "$job_id" --oneliner. scontrol takes options before the command (the rest of this repo uses scontrol show job -o <id>), so --oneliner is often treated as another job id. A non-zero status then does record="", discarding any sacct row. Successful jobs whose accounting is missing or still non-terminal are then judged state=unknown and failed.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fe3a0d4. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant