Skip to content

static-sched: time jobs before spawning their processes - #784

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-static-sched-time-a
Oct 24, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-static-sched-time-a

Conversation

@juliankang4

@juliankang4 juliankang4 commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

static-sched가 작업 시간을 실제보다 짧게 기록하던 결함을 고쳐서, 부모 프로세스가 늦게 깨어나도 3초 작업이 3초로 읽히게 합니다.

What and why

tools/static-sched.py read the start time of a job after subprocess.Popen() returned. When the scheduler process is descheduled between the child starting and Popen() returning, the child has already run for that long, and the job wall loses it. Under load a 3 s step could read a wall of 2 s, and the mac-static self-test that checks "a 3 s step reads a wall of 2 s" went red on a DGX Spark.

The start time is now taken just before Popen() and stored with the job (tools/static-sched.py:239 and :242). A new case in the existing self-test wraps Popen so that it returns one second late, runs sleep 3, and expects both the .wall file and the recorded time in the times file to be at least 3.

Release notes: Fixed: static-sched no longer under-reads a job's wall time when the scheduler is delayed after starting the job.

Code shape

  • No second copy. The change moves one assignment. It adds no helper and no copy of existing logic.
  • Model code holds only architecture facts. No model or engine code changes.
  • Dead code is gone. Nothing was made unused.
  • No silent failure. The self-test case fails loudly if the wall or the recorded time drops below 3.
  • Comments state what is true now. The one new comment says that launch latency belongs to the job's wall.
  • No relaxed gate. No band, tolerance or lint moved.
  • cargo fmt and cargo clippy: no Rust changes (one Python file).

Duplication found or removed (path:line), or "none": none.

What I ran

Head 186efcc5cf15a410cb470a672165c9c14ce1182d, base aafe24c61578ee5839a0508a323d13e7bddc781d (main). Both checks ran on one DGX Spark.

$ bash tools/mac-static.sh --self-test
mac-static: self-test ok

Exit code 0. This includes the new delayed-spawn case.

A separate load reproduction ran eight attempts with 24 CPU burners, then a case where the parent returns late from Popen():

LOAD attempt=1 burners=24 cpu=0 sleep=3 wall=3
...
LOAD attempt=8 burners=24 cpu=0 sleep=3 wall=3
LOAD natural_underreport=False
LOAD delayed_parent=1 sleep=3 wall=3
PASS: all loaded sleep-3 jobs retain wall >= 3

Exit code 0. The same delayed-parent case against the code before this change read LOAD delayed_parent=1 sleep=3 wall=2, and the reproduction ended with FAIL-first: sleep 3 is reported below 3 under CPU load and delayed spawn registration.

I did not run the full just contrib-check tiers or any GPU gate: the change is a scheduler tool in Python and touches no device path.

Hardware (if the change is for a machine)

One DGX Spark, running only the two checks above. No GPU is used by this change.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Oct 24, 2026

@github-actions github-actions 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.

Verdict: CLEAN: The timestamp now precedes spawning, so the recorded wall includes the delay before Popen returns.

Non-blocking

⚠ Report the Python self-test run: tools/static-sched.py:369.
The reported bash tools/mac-static.sh --self-test invokes the scheduler's run mode through tools/mac-static.sh:209; it does not execute this new case.
Run python3 tools/static-sched.py --self-test, attach its output, and correct the claim that the reported command includes the delayed-spawn case.

Checked

Duplicates: the new fixture function late delegates spawning to the existing Popen; it adds no scheduler owner.
Complexity: no Rust functions changed. The scheduler adds no branch; the test adds a subprocess fixture.
Silent failure: 1 subprocess-result site followed; its return code is asserted, and failed assertions make the self-test return 1.
Tests: mutation inspection shows that restoring the post-spawn timestamp excludes the injected 1-second delay. Both wall assertions reject a 2-second record for sleep 3.
Gates: no existing threshold, case or pin changed; the PR reports FAIL-first for the delayed-parent reproduction.
Adversarial: spawn errors still propagate; stop signals remain deferred through registration; a child that exits before registration remains waitable. Both scheduler callers use the corrected owner.
Escape catalog: no C1–C4 pattern matched. This change touches tool code, with no inference hot path.

Notes

The Python self-test was not rerun during validation; the mutation result above is from code inspection.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit ba0c9ad into midagedev:main Oct 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant