From a001bc20bdb3a1d3ba0feee71a562a375e8ff0aa Mon Sep 17 00:00:00 2001 From: x01dc Date: Tue, 21 Jul 2026 15:12:40 +0200 Subject: [PATCH] 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 --- .../plugins/OMNY_shared/tomo_queue_mixin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py index ac8d27a..ac887e0 100644 --- a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py +++ b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py @@ -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} "