Skip to content

LSF: key array elements by JOBINDEX so parent status aggregates correctly - #9

Merged
krokicki merged 3 commits into
mainfrom
fix-lsf-array-jobindex
Oct 16, 2026
Merged

krokicki merged 3 commits into
mainfrom
fix-lsf-array-jobindex

Conversation

@krokicki

@krokicki krokicki commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Problem

JobMonitor.wait_for() resolved for an LSF array job while 3 of 4 elements were still running (#8, also JaneliaSciComp/fileglancer#470).

Root cause

Real bjobs -json output reports the bare parent ID in JOBID for every array element. The index lives only in JOBINDEX, which _BJOBS_FIELDS did not request. Verified on login1:

{"JOBID":"154791288", "JOBINDEX":"195", "STAT":"RUN", "JOB_NAME":"r1_bc1_38JD_a100[195]"}

Consequences:

  1. _parse_job_statuses keyed every element row by the same JOBID, so all rows collapsed into one dict entry. Last row wins.
  2. poll() only recognizes elements by a 12345[1] key. The bare ID fell into the single-job branch and set the parent's status directly, bypassing compute_array_status().
  3. bjobs -a lists elements grouped RUN, then PEND, then DONE last (confirmed across live arrays). So the first poll after any one element finished saw a DONE row last and marked the parent DONE.
  4. Once terminal, the job dropped out of the polled ID list, so the false DONE stuck and array_elements stayed empty.

The unit fixtures used "JOBID": "12345[1]", a format LSF never emits, which is why this wasn't caught.

Fix

  • Add jobindex to _BJOBS_FIELDS.
  • In _parse_job_statuses, re-key rows with a nonzero JOBINDEX as parent[idx]. The existing element paths in poll() and reconnect() then work as designed.

Tests

  • test_real_lsf_format_uses_jobindex: parser re-keys real-format rows and leaves JOBINDEX: "0" singles alone.
  • test_poll_real_lsf_format_one_element_done: reproduces the issue timeline (DONE row listed last, bare IDs). Parent stays RUNNING with all 4 elements tracked.

Both failed before the fix. pixi run check passes (177 tests).

@StephanPreibisch @JaneliaSciComp/fileglancer

krokicki and others added 3 commits October 16, 2026 07:31
…ctly

bjobs -json reports the bare parent ID in JOBID for every array element
and puts the index only in JOBINDEX, which was not requested. All element
rows collapsed into one dict entry (last row wins), and poll() then set
the parent's status directly from that row instead of aggregating via
compute_array_status(). Because bjobs lists DONE elements last, the
parent flipped to DONE as soon as any single element finished, and
array_elements was never populated.

Request jobindex and re-key element rows as "parent[idx]" so the
existing element-handling paths in poll() and reconnect() work.

Fixes #8. Also reported as JaneliaSciComp/fileglancer#470.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
LSF reports the bare parent ID in JOBID and the index in JOBINDEX;
the fixtures previously used a "12345[1]" JOBID that LSF never emits.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The previous commit swept in a local WIP change to lsf.py via a
mistaken `git stash pop`. Restore lsf.py to the fix commit's version.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@krokicki
krokicki merged commit ae98834 into main Oct 16, 2026
1 check passed
@krokicki
krokicki deleted the fix-lsf-array-jobindex branch October 16, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant