feat: add Slurm retry and deterministic collection - #915
Conversation
Greptile SummaryThe PR adds persisted retry and deterministic collection capabilities for Slurm runs, including recovery of ambiguous submissions.
|
| Filename | Overview |
|---|---|
| packages/data-designer-slurm/src/data_designer/slurm/state/submission_recovery.py | Implements deadline-bounded recovery with exact ordinary or sparse-array shape matching, resolving the previously reported permanent PREPARED states. |
| packages/data-designer-slurm/src/data_designer/slurm/state/retry.py | Reconciles prepared retry submissions before proceeding and binds recovered scheduler identities into persisted retry state. |
| packages/data-designer-slurm/src/data_designer/slurm/state/collection.py | Adds persisted collection submission, reconciliation, refresh, result validation, and failed-stage cleanup. |
| packages/data-designer-slurm/src/data_designer/slurm/launcher/client.py | Adds exact-name current-user submission lookup across active and accounting scheduler views and classifies ambiguous submission failures. |
| packages/data-designer-slurm/src/data_designer/slurm/state/collection_merge.py | Adds deterministic bounded-row Parquet merging and partitioned Parquet, CSV, or JSONL output. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
P[Persist PREPARED operation] --> S[Submit Slurm job]
S -->|Receipt received| B[Bind scheduler identity]
S -->|Ambiguous outcome| Q[Query squeue and sacct by exact name and UID]
Q -->|Exact shape match| B
Q -->|Absent or partial before deadline| W[Remain PREPARED and retry reconciliation]
W --> Q
Q -->|Bounded absence after deadline| F[Mark operation FAILED]
F --> R[Permit replacement submission]
B --> E[Execute identity-fenced retry or collection]
Reviews (8): Last reviewed commit: "fix(slurm): bound partial array recovery" | Re-trigger Greptile
| if status.state is RetryState.PREPARED: | ||
| raise StateConflictError("previous retry submission has an ambiguous scheduler outcome") |
There was a problem hiding this comment.
Ambiguous retries remain permanently blocked
When sbatch raises SlurmSubmissionError with may_have_succeeded=True, _submit leaves the retry in PREPARED, and every subsequent retry call rejects that state before reconciliation. This permanently prevents the run from retrying any failed shard, even after the ambiguous job has terminated or was never submitted.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/data-designer-slurm/src/data_designer/slurm/state/retry.py
Line: 110-111
Comment:
**Ambiguous retries remain permanently blocked**
When `sbatch` raises `SlurmSubmissionError` with `may_have_succeeded=True`, `_submit` leaves the retry in `PREPARED`, and every subsequent retry call rejects that state before reconciliation. This permanently prevents the run from retrying any failed shard, even after the ambiguous job has terminated or was never submitted.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in b994ac3. PREPARED retry and collection submissions now reconcile from a fresh process by a plan-derived exact job name across current-UID squeue and sacct views, validate ordinary-versus-array shape and the complete sparse task set, and persist a bounded visibility deadline. Exactly one match is rebound to its real scheduler ID; multiple or mismatched matches fail safely; authoritative absence after the deadline retires the prepared operation so a later call can proceed. Retry attempt identity and collection worker identity fence any delayed old allocation from writing, and the collection worker waits outside the state lock when it starts before its ID is durably bound. Regression coverage includes accepted receipt loss and fresh-process recovery, delayed visibility, definite absence, multiple/wrong-shape matches, concurrent collection startup, and late-allocation fencing. Validation: 47 focused recovery tests passed; full Slurm suite 1,214 passed; Ruff/format/strict complexity and isolated wheel install/import smoke passed.
28e7efe to
1300bc0
Compare
b994ac3 to
b7e8653
Compare
1300bc0 to
a4f4035
Compare
b7e8653 to
8b1996f
Compare
a4f4035 to
91129f8
Compare
8b1996f to
2be1a46
Compare
| if match.array_task_ids != prepared.expected_array_task_ids: | ||
| raise StateConflictError("scheduler job shape does not match the prepared submission") |
There was a problem hiding this comment.
Partial array views block recovery
If a completed sparse-array task has left squeue before appearing in sacct, the merged task IDs are a strict subset of the planned shape. This exact comparison raises StateConflictError before the visibility-deadline branch and leaves the retry in PREPARED, so every subsequent retry remains blocked.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/data-designer-slurm/src/data_designer/slurm/state/submission_recovery.py
Line: 61-62
Comment:
**Partial array views block recovery**
If a completed sparse-array task has left `squeue` before appearing in `sacct`, the merged task IDs are a strict subset of the planned shape. This exact comparison raises `StateConflictError` before the visibility-deadline branch and leaves the retry in `PREPARED`, so every subsequent retry remains blocked.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in 359b53fc. Strict-subset sparse-array observations are now treated as incomplete scheduler visibility: they remain pending through the reconciliation deadline, then resolve to bounded absence so the PREPARED retry can fail and be safely replaced instead of blocking forever. Non-subset/ordinary shape mismatches still fail closed. Regression coverage exercises both the at-deadline wait and post-deadline retirement; focused recovery/retry tests pass (47), and the full Slurm suite passes (1,282).
91129f8 to
57e9671
Compare
359b53f to
76b8a30
Compare
57e9671 to
b00ccb1
Compare
76b8a30 to
9dfa408
Compare
b00ccb1 to
506de48
Compare
Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
9dfa408 to
4ddab96
Compare
📋 Summary
Implements the #869 retry-and-collection slice for persisted Slurm runs. Failed shards can be retried from fresh reconciliation state, and exactly one validated winner per planned shard is collected by a zero-GPU CPU Slurm job into a deterministic, atomically published dataset.
This PR is stacked on #913. PR #913 must merge first. The branch was restacked after #910 merged into the shared Slurm base and remains exactly four slice commits above the synchronized #913 head (
506de489). It consumes #913's public observation/reconciliation APIs and adds capability APIs only; CLI wiring remains owned by #874#3.🔗 Related Issue
Closes #869
🔄 Changes
✨ Added
🔧 Changed
🐛 Fixed
PREPARED.PREPARED.🧪 Testing
make check-slurm✅ Checklist
Description updated with AI