Skip to content

Issue ##191:Adds segmentation queue#4

Open
babo989 wants to merge 1 commit intomainfrom
feature/segmentation-queue-v2
Open

Issue ##191:Adds segmentation queue#4
babo989 wants to merge 1 commit intomainfrom
feature/segmentation-queue-v2

Conversation

@babo989
Copy link
Copy Markdown
Collaborator

@babo989 babo989 commented Mar 31, 2026

Segmentation Queue Feature

Summary

Adds multi-select batch segmentation to the Segmentation page. Users can select multiple acquisitions to segment, adding them to a queue for sequential processing. The queue lives entirely in Node-RED

Branch

  • Dashboard repo (github.com/fairscope/dashboard): feature/segmentation-queue-v2

What Changed

Modified Nodes

Node ID Name Change
8a22543633712279 List of Acquisitions Added checkboxes (show-select), "Segment Selected" button, queue status chips (Segmenting/Queued/Done/Error), cancel buttons, queue summary bar
60bfa71a5e7fc2d5 Dialog Added batch mode: shows acquisition count + summary list when multiple selected, sends queue_confirmed topic instead of segmenter/segment
98b980828cac388b Topic switch Added 3rd output with regex rule ^queue_ to route queue topics
9a2e04f65e0432e1 MQTT in (status/segmenter) Added wire to Queue Status Handler
66f970bece31600d Page load switch Added wire to Queue Status Refresh (restores queue state on page navigation)

New Nodes (on Segmentation tab)

Node ID Type Name Purpose
a1b2c3d4e5f60001 switch Route queue topics Routes queue_segment_request, queue_cancel, queue_cancel_all to the Queue Processor
a1b2c3d4e5f60002 function Queue Processor Core queue logic: initializes queue from confirmed dialog, processes one item at a time via MQTT, advances on completion/error, handles cancellation
a1b2c3d4e5f60003 function Queue Status Handler Listens to status/segmenter MQTT messages and forwards them to the Queue Processor when a queue is active
a1b2c3d4e5f60005 function Queue Status Refresh Sends current queue state to the table when user navigates to the Segmentation page

Python Changes

None. The queue sends requests using the existing MQTT contract (segmenter/segment / status/segmenter).

How It Works

User Flow

  1. User checks multiple rows in the acquisitions table with checkboxes on the left
  2. A nice toolbar appears: "N selected" + "Segment Selected" button
  3. Clicking "Segment Selected" opens the batch dialog showing selected acquisitions and the ESD threshold setting
  4. On confirm, the queue starts , first acquisition is sent to the segmenter via MQTT
  5. The table shows inline status per row: spinner for processing, "Queued" chip for pending, green "Done" or red "Error" for completed
  6. A summary bar shows overall progress: "X done, 1 processing, Y pending"
  7. When all items finish, the queue deactivates and selection clears
  8. If a user wishes to manually set different ESD minimums, you can just hit sequential projects via the usal 'segment' and they will add to the queue

Data Flow

Table "Segment Selected" -> queue_segment_request
  -> Route queue topics -> Queue Processor (output 2: open dialog)
    -> add process_min_ESD -> Dialog (batch mode)
      -> queue_confirmed -> Queue Processor (start queue)
        -> output 0: segmenter/segment -> MQTT out (one at a time)
        -> output 1: queue_status -> Table (inline status updates)

MQTT in (status/segmenter) -> Queue Status Handler
  -> queue_status_update -> Queue Processor (advance/error/done)
  -> queue_progress -> Table (progress display)

Page load -> Queue Status Refresh -> Table (restore state)

Flow Context Variables

  • seg_queue — Array of pending {item} objects
  • seg_queue_current — Currently processing item or null
  • seg_queue_results — Array of {path, acquisition_id, status, error?} for completed items
  • seg_queue_active — Boolean, true while queue is running
  • seg_queue_settings{process_min_ESD} confirmed in dialog
  • seg_queue_retry_pending — Boolean, set when segmenter responds "Busy"

Edge Cases to notice when trying to debug odd behavior

  • Single segment while queue active: Per-row "Segment" button is disabled during queue operation
  • Segmenter busy: Queue Processor re-enqueues the current item and waits for "Done" or "Ready" before retrying
  • Page navigation: Queue Status Refresh restores queue state when returning to the Segmentation page
  • Segmentation failure: Error is recorded, queue continues to next item
  • Segmenter crash ("Dead"): Queue halts, error reported in UI
  • Interruption: Queue halts entirely
  • Cancel: "Cancel pending" removes all queued items; per-item cancel (X button) removes individual items. Neither stops the in-progress segmentation.

@babo989 babo989 requested a review from jeremyszym March 31, 2026 07:46
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