fix(agent): coherent job detail for array, requeued, and reused job-ids - #752
Draft
pramasoul wants to merge 1 commit into
Draft
fix(agent): coherent job detail for array, requeued, and reused job-ids#752pramasoul wants to merge 1 commit into
pramasoul wants to merge 1 commit into
Conversation
SlurmrestdFiltered.job() took [0] of the slurmctld and slurmdbd job lists and blindly dict.update()-merged them. That is wrong whenever a job-id maps to multiple records: array tasks (each a separate record with a distinct internal job-id), requeue/preempt lifecycle duplicates, and reused job-ids. [0] then picks an arbitrary record and splices the live state of one task onto the accounting of an unrelated job (and IndexError-crashes on jobs aged out of slurmctld). Select coherent records instead: the slurmctld record (most-recently-started queued task) is authoritative for current state, and the slurmdbd record merged in is the one describing the same task/run (matched by job-id + array task-id, latest start to skip requeue duplicates). Aged-out jobs fall back to the most recent accounting record. Accounting is optional: if the slurmdb query errors or 404s (no slurmdbd), job detail is served from slurmctld alone. Single-record jobs are unaffected. Adds tests for the multi-record, aged-out, not-found, and no-accounting cases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
rezib
self-requested a review
June 22, 2026 07:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SlurmrestdFiltered.job()builds the job-detail object by taking the first element ([0]) of the slurmdbd and slurmctld job lists and blindly merging them:This assumes
GET /job/{id}returns exactly one record. It does not whenever a job-id maps to multiple records:[0]then picks an arbitrary record anddict.update()mashes two unrelated records into one. We hit this in production:GET /job/<id>showed a job displayed as RUNNING (the live array task) carrying the end-time / exit-code of a different job from a month earlier that had reused that id — a self-contradictory detail page. (For jobs aged out of slurmctld,_ctldjob's[0]can also raiseIndexErrorrather than returning a clean not-found.)Fix
Select coherent records instead of
[0]:IndexError.Single-record jobs (the common case) are unaffected: one record in each list → identical result.
Tests
Adds four tests to
TestSlurmrestdFiltered(mocking_requestkeyed on component, so no version-specific fixtures): multi-record coherence, aged-out-of-slurmctld, not-found, and no-accounting.Co-authored with Claude Code (Anthropic). Opened as a draft pending CI + the CLA signature.