fix/tomo_queue_reacquire wrongly blocked on a later incomplete job

The single-resumable-job invariant check scanned all other jobs, but
jobs after job_index get force-reset to pending anyway -- so a later
incomplete/running job was never a real conflict, only an earlier one
is (since earlier jobs are left untouched).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
x01dc
2026-07-21 15:12:40 +02:00
co-authored by Claude Sonnet 5
parent d963cd6dfd
commit a001bc20bd
@@ -872,10 +872,11 @@ class TomoQueueMixin:
Raises:
TomoQueueError: ``job_index`` is out of range, the job at that
index is a command job (not a tomo scan), or some *other*
index is a command job (not a tomo scan), or some *earlier*
job in the queue is already "incomplete"/"running" (the
queue's single-resumable-job invariant -- resolve that one
first, or pass its own index).
first, or pass its own index). A later job in this state is
not a conflict -- it gets reset to "pending" below anyway.
ValueError: ``projection_number`` is out of range for this
job's own tomo scan parameters.
"""
@@ -890,8 +891,8 @@ class TomoQueueMixin:
"command job, not a tomo scan -- nothing to reacquire."
)
for idx, other in enumerate(jobs):
if idx != job_index and other.get("status") in ("incomplete", "running"):
for idx, other in enumerate(jobs[:job_index]):
if other.get("status") in ("incomplete", "running"):
raise TomoQueueError(
f"tomo_queue_reacquire: job #{idx} ('{other['label']}') is already "
f"'{other['status']}' -- resolve it first (or pass index {idx} "