Skip to content

fix(slurm): let a CPU-only run's saved-answer re-judge queue and refresh its metrics - #6210

Merged
trias702 merged 2 commits into
mainfrom
degert/slurm-cpu-rejudge
Nov 17, 2026
Merged

trias702 merged 2 commits into
mainfrom
degert/slurm-cpu-rejudge

Conversation

@trias702

Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes the CPU-only branch of SlurmExecutor.reverify_judge_failures (gym eval resubmit <job> <benchmark> --recover when the decision is reverify). A run whose only open rows are judge failures could not be re-judged there, and once past that the re-judge left the run's score and health stale. The GPU branch (_queue_judge_job) is unchanged.

Found while onboarding EQ-Bench 4 (step 7b judge fixture: a 3-row CPU-only run with an invalid judge key). The first inspect planned reverify with 3 judge_recoverable rows, and --recover stopped with:

actual chain walltime or retry accounting is unknown

The three gaps, all on the CPU-only path

  1. An absent retry counter read as unknown. resume_script writes .gym_infra_retries on the first infra retry, so a chain that never retried has none. The recovery decision counts an absent file as 0 (recovery.py, _decide_from_collected: {"absent": 0, "ok": ...}.get(infra_retries_state)), but the dispatch read the raw infra_retries_used, which is None, and refused. It now maps the state the same way: absent is 0, malformed or unknown still refuses.
  2. The chain's own ordinary stop read as an incomplete chain. A job that ends its chain with nothing eligible for another attempt (exit 76) writes NO_ELIGIBLE_RETRY_REASON to .gym_chain_incomplete. That is how every run whose only open rows are judge failures ends, so the chain_incomplete check refused every such run. The collector now reports chain_ended_itself (the marker's first line is exactly that reason), and the dispatch accepts that one marker. Every other marker line (a continuation that ended before its guard, unknown accounting, a cancelled or refused follow-up, ...) still refuses, and the dispatch-time digest check of .gym_chain_incomplete is unchanged.
  3. No metrics or health refresh after settling. The GPU branch passes --settle-receipt, which makes cli/eval.py::_reverify_with_receipt call _refresh_settled_source after the settle pass. The CPU-only branch did not, so rollouts_aggregate_metrics.json and quality_summary.json kept their pre-re-judge contents. The final inspect then read every row as scored but the gate as FAILED ("no requested metric was read"), with health UNVERIFIED ("quality summary is not bound to this run's sole rollouts.jsonl source"). The CPU-only command now passes --settle-receipt <reverification folder>/receipt.json, beside its output. The receipt is only read through the judge-job journal, which the CPU-only branch does not write, so nothing else reads it.

Changes

File Change
nemo_gym/orchestration/executors/slurm.py CPU-only branch of reverify_judge_failures: retry count from infra_retries_state; accept chain_ended_itself; pass --settle-receipt
nemo_gym/orchestration/collect_evidence.py Embed NO_ELIGIBLE_RETRY_REASON; collect chain_ended_itself
nemo_gym/orchestration/recovery.py CollectedEvidence.chain_ended_itself: bool = False
tests/unit_tests/orchestration/test_slurm_rejudge.py New cases first_allocation (no retry file, self-ended marker: queues) and incomplete (another marker: refuses); the queued command carries the receipt beside its output
tests/unit_tests/orchestration/test_eval_resubmit_decision.py The collector sets chain_ended_itself only for that marker line

A pinned remote Store reader older than this change lacks the new field; the executor already takes every field missing from the reader's projection from the host collection, so the value is the host's either way.

Validation

Linux (WSL2, Python 3.13.14), on origin/main:

Check Result
pytest tests/unit_tests/orchestration/test_slurm_rejudge.py tests/unit_tests/orchestration/test_collect_evidence_module.py tests/unit_tests/orchestration/test_eval_resubmit_decision.py::test_the_collector_names_a_chain_that_ended_itself 14 passed
Same tests with only the source change reverted 7 failed (first_allocation, the receipt assertion in ok/large, all 4 collector cases)
pytest -n 8 tests/unit_tests/orchestration tests/unit_tests/eval tests/unit_tests/cli 4759 passed, 5 skipped, 6 failed. The 6 (test_eval_resubmit.py::test_a_resubmitted_job_normalizes_resume_before_exporters_open, ::test_resubmit_normalizes_an_older_saved_job_script) fail identically without this change: ModuleNotFoundError: No module named 'mlflow' in this environment
pre-commit run --files <changed files> All hooks pass

On the cluster: with the first two gaps worked around by correcting only those two evidence fields before Gym's own dispatch, the judge fixture's re-judge queued and settled all 3 rows from the saved answers, with no policy calls. Its final inspect showed the third gap (gate FAILED, health UNVERIFIED), which this PR also fixes.

Compatibility

  • Only the CPU-only re-judge dispatch changes. The recovery decision, the GPU judge-only job and every other marker or counter state behave as before.
  • CollectedEvidence gains one optional field with a default, so evidence from an older collector still validates.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification. (N/A: internal recovery behaviour; the CLI and its documented outcomes are unchanged.)
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass). (Passes on all changed files; --all-files not run.)
  • New source files include the required Apache-2.0 SPDX header. (No new files.)
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@trias702 trias702 added bug Something isn't working area:orchestration Job submission, deployment, services, and lifecycle management labels Nov 15, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 15, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@trias702

Copy link
Copy Markdown
Collaborator Author

/ok to test 608fec7

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 15, 2026 23:42

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP

LGTM. No concerns found.

I reviewed all five changed files and traced the affected recovery paths, including accounting safeguards, older-reader compatibility and the settled-source metrics and health refresh.

This was a static review. I did not execute tests.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the ready-to-merge PR is approved, current, and waiting for final CI or merge label Nov 16, 2026
@trias702
trias702 enabled auto-merge November 16, 2026 17:57
@yfw

yfw commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

/ok to test c409e07

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 17, 2026
@trias702
trias702 added this pull request to the merge queue Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43991518627

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43991648720

Merged via the queue into main with commit b06f024 Nov 17, 2026
68 checks passed
@trias702
trias702 deleted the degert/slurm-cpu-rejudge branch November 17, 2026 01:11
prokotg added a commit that referenced this pull request Nov 17, 2026
Ports main's changes to the files this PR moved:
- orchestration/recovery.py (#6210, #6080, #6223): 3 symbols changed and 6 added, into the eval/recovery
  modules; NO_ELIGIBLE_RETRY_REASON moves to eval/recovery/markers.py because the evidence reader now
  uses it.
- executors/slurm.py (#6210, #6223, #6215): the 12 hunks, into executors/slurm/chain.py, judge_job.py and
  reader.py.
- tests that import the old module paths (the otel, resubmit and recovery tests added since).

Signed-off-by: Tomasz Grzegorzek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:orchestration Job submission, deployment, services, and lifecycle management bug Something isn't working ready-to-merge PR is approved, current, and waiting for final CI or merge sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants