Repository navigation
ODM: stop duplicate tasks, make them identifiable, and make results recoverable - #84
Conversation
A user queued about a dozen identical reconstructions without meaning to, then saw only "Status: Queued, Progress: 0%" for two hours and reported it as a hang (MorphoCloud/Instances#139). The module made all of that easy: - The Run button was never disabled, so every click created another task on the node -- and each one overwrote self.webodmTask, so Slicer forgot the task it had just made while it kept running server-side. - create_task uploads every image on the UI thread with no progress_callback, freezing Slicer for minutes, while the button and its popup both claimed the operation was "(non-blocking)". - The status line never mentioned the node queue, so a task waiting behind eleven others was indistinguishable from a hang. - Nothing could cancel a task from inside Slicer; the only remedy was a browser pointed at a URL the module never showed. Changes: - Hold the Run button disabled for the whole of onRunWebODMTask (split into a guard + _runWebODMTask so an early return still re-enables it). - Query node.info() before creating: this is the first call that proves the node is reachable (Node.__init__ does no I/O), and it surfaces task_queue_count so we can ask before piling on. - Drive a progress dialog from pyodm's progress_callback during upload. - Report queue depth alongside a QUEUED status. - Add a Cancel Task button (Task.cancel()), and make Stop Monitoring say plainly that the task keeps running. - Add a clickable Node Dashboard link that tracks the IP/port fields. - Drop the false "(non-blocking)" from the button and popup. Also default matcher-type to flann, ODM's own default, which the tooltip already documented. bruteforce was preselected and, since turntable images carry no GPS EXIF, OpenSfM falls back to matching all pairs -- so every run was doing exhaustive descriptor matching over every pair. Separately, this file wrote "\\n" in 38 places, which renders as a literal "\n" in the dialog rather than a line break; the other 37 strings in the same file already used "\n". Repaired throughout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @muratmaga's task in 4m 0s —— View job Review: PR #84 — ODM: stop the UI from silently queueing duplicate tasks
SummaryOverall this is a solid, well-scoped fix for the observability half of the reported problem (upload freeze, opaque "Queued, 0%" status, no cancel path, Main finding (posted inline on Minor/non-blocking observations (not filed inline, lower confidence):
No security issues found (no new subprocess/user-input handling introduced). The |
Addresses the review on #84: the duplicate-task path was still reachable. Run was only held disabled for the duration of _runWebODMTask, so once a task was created and monitoring began the button came straight back -- and a second click would create another task on the node and overwrite self.webodmTask/self.webodmTimer, orphaning the first. That is exactly the behaviour the PR claimed to fix, and it is the likelier route to the dozen queued jobs in MorphoCloud/Instances#139: the user sees "Queued, 0%", concludes it is stuck, and clicks Run again. - Add _updateTaskButtons() as the single source of truth: Run is enabled only when no task is tracked; Stop Monitoring and Cancel only when one is. All four teardown paths (stop, cancel, completed, failed) go through it. - Add a hard guard at the top of _runWebODMTask: refuse to start when self.webodmTask is not None, rather than relying on the server-side queue-count prompt, which is dismissible and does not prevent the local overwrite. Also fix the off-by-one the review flagged in the queued status line. NodeODM's getQueueCount() counts QUEUED+RUNNING including this task (libs/TaskManager.js:305-316), so report count-1 as the number ahead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @muratmaga's task in 1m 9s —— View job Review: PR #84 (update) — fix in
|
Review reconciliation (ce3f260)All three findings addressed — two fixed, one declined with reasoning. 1. Duplicate task still reachable — FIXED (ce3f260). Correct, and it was the main scenario rather than an edge case; details in the inline reply. Run is now gated on 2. Queue-depth off-by-one — FIXED (ce3f260). Confirmed against the source: 3. Extra Still not exercised against a live NodeODM — ODM is Linux/Docker/GPU by design, so that check has to happen on Linux before merge. |
Caught on a real node: when create_task fails, the "Creating NodeODM Task" progress dialog stays on screen behind the error. slicer.util.errorDisplay is modal, so raising it from the except block blocks before the finally that closes the progress dialog ever runs. Capture the exception, let the finally take the dialog down, then report. Found while testing against a NodeODM started with --test, which rejected feature-type=dspsift. That rejection is a test-mode artifact -- odmRunner's getJsonOptions returns a mock (tests/odm_options.json) instead of asking ODM, and that mock's feature-type enum predates dspsift -- but the stranded dialog it exposed is real and would show on any task-creation error. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @muratmaga's task in 50s —— View job Claude finished @muratmaga's task —— View job Review: PR #84 (update) —
|
Observed on a real node: two tasks with different UUIDs both showed Name: SlicerReconstruction_15b1cf4b, and both mapped to one folder, WebODM_SlicerReconstruction_15b1cf4b. The suffix is not the UUID -- it is sha256(params)[:8], a pure function of the settings -- so any two runs with the same settings are indistinguishable on the dashboard and collide on disk, the second download landing on top of the first. - generateShortTaskName appends a YYYYMMDD-HHMMSS stamp. The node name and the WebODM_<name> folder are then 1:1 and unique per run. The params hash stays so settings remain readable at a glance. - Log the node task UUID and the download path when a task is created, so the console records the tie to the node's own identifier. - Create the output folder at download time, not at task creation. It was created up front, so any task that was never downloaded (Stop Monitoring, a failure, a restart) left an empty WebODM_<name> folder that looked like output and sent Import Reconstructed Model hunting for an odm_texturing that was never coming. - Sort the folder list in onImportModelClicked. os.listdir is in filesystem order, so `webodm_dirs[-1]` was an arbitrary folder despite being called latest_dir; with the timestamp suffix, sorting makes it genuinely the newest. Does not address re-attaching to an abandoned task (Stop Monitoring is still a one-way door). pyodm's Node.get_task(uuid) and NodeODM's GET /task/list make that feasible; it wants its own PR, and the module already carries commented-out Save/Restore Task buttons scoped for exactly that. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @muratmaga's task in 1m 46s —— View job Review: PR #84 (update) —
|
… door Slicer held exactly one task in self.webodmTask, and nothing could ever get it back. Stop Monitoring, a Slicer restart, or a crash left the task running on the node with no code path anywhere in the module able to download its results -- the user's only recourse was the NodeODM dashboard. Naming the output folder well says where results would have gone; it cannot fetch them. The module already carried commented-out "Save Task"/"Restore Task" buttons and stub handlers: the original author scoped this and never built it. - "Reconnect to Task on Node..." lists what the node has (GET /task/list gives UUIDs only, so each is expanded via Task.info()), shows name/status/date/image count newest-first, and resumes monitoring the chosen one via Node.get_task(uuid). - Results route to WebODM_<task name>, matching the naming scheme, so a reconnected task lands exactly where it would have originally. Tasks created outside Slicer have no name; those fall back to WebODM_task_<uuid8>. - Reconnecting to an already-finished task downloads it immediately: the first poll is fired directly rather than waiting for the 5s tick. - Reconnect is the inverse of the task controls, so it shares _updateTaskButtons(): available only when no task is tracked. Tasks the node has forgotten are out of reach -- NodeODM's cleanup_tasks_after defaults to 2880 minutes (48h). Noted in the button tooltip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @muratmaga's task in 2m 41s —— View job Review: PR #84 (update) —
|
Every task was called SlicerReconstruction_<settings-hash>_<time>. None of that says which photos went in, so two specimens uploaded with the same settings were distinguishable only by a timestamp -- on the node, which has no idea what a folder is, they were unidentifiable. The dataset identity already existed in the input folder path; the module threw it away and substituted a constant. - The 'name' field now defaults to the images folder's own name (UWBM_82409), sanitised for use in a folder name, and follows the folder selector until the user types their own (tracked via textEdited, which only fires for real typing). A task is now UWBM_82409_<hash>_<time>: which photos, which settings, when. - Write a WebODM_<name>.json record beside where the results will land, holding the node's task UUID, node URL, image count, images folder and full options. The UUID is the only identifier unique by construction, but it lives only on the node, which forgets finished tasks after 48h; the record is what survives that, Stop Monitoring, and restarts. An images folder becomes self-describing: one .json per job submitted from it, next to the folder it will produce. - Reconnect cross-references the node's task list against those records and marks which tasks came from this folder, and a matching record is authoritative for where results are downloaded. - Guard against name collisions on disk. The stamp has one-second resolution, so two jobs submitted inside the same second produced one name -- the second job's record and results silently landing on the first's. Caught by a probe that submitted twice in the same second on its first run, so it is not theoretical for small datasets on a fast node. Names now get -2, -3 on collision. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @muratmaga's task in 4m 27s —— View job Review: PR #84 (update) —
|
…ndings Addresses the review of 8eada1c. - Import Model was broken by 8eada1c, for every task. writeTaskRecord writes WebODM_<name>.json beside the results folder, onImportModelClicked matched on d.startswith("WebODM_") with no isdir check, and "WebODM_X.json" always sorts after "WebODM_X" -- so it picked the record file and went looking for odm_texturing inside a JSON file. Filter to directories. - Order those folders by mtime rather than by name. The review was right that the earlier lexicographic sort only looked chronological while the prefix and hash were constant; a name now leads with the dataset name and a settings hash, so sorting by name reorders runs as soon as either differs. mtime is when the results actually landed. - Sanitize a hand-typed dataset name. Only folder-derived names were cleaned, and folder-tracking stops the moment the user types their own -- so typed text was reaching webodmOutDir, taskRecordPath and uniqueTaskName unguarded. - Lead the reconnect picker with the task's UUID. The picker returns the chosen string and we map it back with labels.index(), so two tasks rendering identical text would attach the wrong one; unnamed tasks sharing a status, date and image count do exactly that. UUIDs are unique by construction, and the UUID is also the first thing the dashboard shows, so it is what you match by eye. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @muratmaga's task in 1m 31s —— View job Review: PR #84 (update) —
|
Review reconciliation (86ed20f) — all findings closedFixed and verified by the review: the Import Model regression (isdir filter), the non-chronological sort (now mtime), the picker-label collisions (UUID-led labels), and the unsanitized typed dataset name (single
self.date_created = datetime.utcfromtimestamp(int(json['dateCreated'] / 1000.0))A direct index, not The inconsistency the review spotted is real but backwards: Testing status. Driven against a live GPU NodeODM on a MorphoCloud instance: upload progress, the queue prompt, Run correctly refusing while a task is monitored, and Reconnect attaching to a live task. Not driven on Linux: Cancel against a real task, and the naming/record work, which postdates that session. Widget-level behaviour for all of it was exercised in a live Slicer against a stubbed node. |
Why
A user queued ~a dozen identical reconstructions without meaning to, saw only
Status: Queued, Progress: 0%for two hours, and reported it as a hang (MorphoCloud/Instances#139). The support answer was "open Firefox at localhost:3002 and cancel them" — a URL the module never mentions.Fixing that surfaced a family of related problems: you couldn't tell tasks apart, couldn't get results back if Slicer stopped watching, and couldn't tell which photos a task came from.
What changed
Stops the pile-up
_updateTaskButtons()is the single source of truth), plus a hard guard in_runWebODMTask. Previously every click created another task and overwroteself.webodmTask, orphaning the last one.node.info()before creating: it's the first call that proves the node is reachable (Node.__init__does no I/O) and it exposestask_queue_count, so we can ask before piling on.count - 1; NodeODM counts your own task).Makes the work visible
progress_callback— the upload runs on the UI thread and used to freeze Slicer silently while the button promised "(non-blocking)".Task.cancel()); Stop Monitoring now says the task keeps running.Makes tasks identifiable
name:defaults to the images folder's basename and follows the folder selector until you type your own.UWBM_82409_<settings-hash>_<timestamp>says which photos, which settings, when. Previously every task wasSlicerReconstruction_<hash>— a pure function of the settings, so two runs collided on the node and on disk, the second download landing on the first.WebODM_<name>.jsonrecord per job, holding the node's task UUID, node URL, image count, images folder and options. An images folder becomes self-describing.Makes results recoverable
GET /task/list+Task.info()), cross-references the local records to tag which are yours, and resumes monitoring viaNode.get_task(uuid). Reconnecting to a finished task downloads it immediately. The module already carried commented-out Save/Restore Task buttons scoped for this.Other
matcher-typedefaults toflann, ODM's own default, which the tooltip already documented.bruteforcewas preselected, and since turntable images carry no GPS EXIF OpenSfM falls back to all-pairs matching — every run was doing exhaustive matching over every pair.\\n, rendering a literal\nin dialogs instead of a line break; the other 37 in the same file already used\n.Testing
Driven on a real MorphoCloud instance against a live GPU NodeODM: upload progress, the queue prompt, Run correctly refusing while monitoring, and Reconnect attaching to a live task all confirmed by the author. Widget behaviour (button states, picker contents/ordering, naming, sanitising, record round-trip, Import folder selection) exercised in a live Slicer with a stubbed node.
Not yet driven end-to-end on Linux: Cancel against a real task, and the task-record/naming work, which postdates the author's session.
Known, deliberately not in this PR
reruncombo does nothing. It shipsrerun=openmvson every task, but NodeODM discards it —odmInfo.js:83-88excludes--rerunwhen building its accepted-option list, and unknown options are never read. Inert, not harmful (checked onmasterandv2.1.0). Suggest deleting the combo.matcher-neighborsis GPS-only and inert on no-GPS turntable sets; both16and the default0end in all-pairs.--matcher-orderis the filename-order knob, but it doesn't wrap (no loop closure on a 360° set) and ODM ignores it on georeferenced/GCP runs."Task failed or canceled"doesn't say which or why, andTaskInfo.last_erroris never shown.download_assetsblocks the UI thread with no progress, as the upload used to.🤖 Generated with Claude Code