Pull request #434: Background editor status fixesMerge in PT/oneposda from background-editor-status-fixes to master
* commit 'be956c6ef7e75683003de429a50aab6d95ca152c':
Make stalled activity_task_status rows visible
Gate NewSubprocessEditor per-file debug output behind POSDA_DEBUG
Stop WorkerNode losing subprocess stderr
Fix LineReader EOF fall-through and two BackgroundEditorTp bugs
Close out activity_task_status from an END block...
Throttle activity status updates in CreateActivityTimepointFromFileIdsSetActivityStatus was called after every single-row insert; now it only
fires every 1000 files (and on the final file) to cut DB churn.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J7koX7JPvgJbNTwprRessU
Make stalled activity_task_status rows visibleThe table had no primary key, no unique constraint and no index at all, so
every heartbeat was a sequential scan and nothing prevented duplicate rows.
Add an index on (activity_id, subprocess_invocation_id) plus a partial index
over open rows.
Deliberately not a primary key yet: existing deployments may already hold
duplicates, which would make ADD PRIMARY KEY fail mid-deploy. The migration
ca...
Gate NewSubprocessEditor per-file debug output behind POSDA_DEBUGEight of these run concurrently under BackgroundEditorTp.pl and all inherit the
worker's stderr capture file. Dumping the whole edit struct for every DICOM
file made that file large enough to slow the upload appreciably and widen the
window in which a straggler could still be writing to it. Genuine errors and
warnings stay unconditional.
Uses the same env flag as the existing checks in Dispatc...
Stop WorkerNode losing subprocess stderrThree problems, all on the path that captures a job's output.
An upload failure left stdout_file_id/stderr_file_id unbound, so the reference
below raised UnboundLocalError, which the blanket handler in work_loop caught
and logged in place of the real error. Bind them before the try and log the
traceback.
wait() returns when the direct child exits, but background scripts leave
children running...
Fix LineReader EOF fall-through and two BackgroundEditorTp bugsLR_line_reader's EOF branch deletes {lh} and then fell through to the line
dispatch loop, so any line still buffered at EOF was handed to an undefined
code ref. Dispatch complete lines before teardown, then return.
In CountPrinter, the else branch guarding compares_complete set $num_comparing
instead of $num_compares_complete, leaving it undef -- a NULL bind into
UpdateDicomEditCompareDisposit...
Close out activity_task_status from an END blockBackstop for anything that leaves without going through Shutdown: an uncaught
die out of the dispatch loop, a signal, an exit path nobody anticipated. There
is no staleness check anywhere, so an unclosed row reads as running in the UI
forever until a human dismisses it.
Guarded on $$ matching the pid recorded at startup: the forked editor children
normally exec, which discards END blocks, but ...
Stop one unparsable compare line abandoning an entire edit runThe default case in the StreamingEditCompare.pl output parser called exit,
which meant a single line matching neither Completed: nor Failed: threw away a
run that could have hours of edits behind it. That child is launched with
2>/dev/null, so whatever provoked the line is already gone.
Record the line in the Errors report and carry on, giving up through Shutdown
only once MaxBadCompareLines o...
Add a single exit point to BackgroundEditorTp.plBare exit() from inside the dispatch loop left up to $num_simul
NewSubprocessEditor.pl children running -- they reparent to init and keep
editing -- never called Finish, and returned status 0, so the worker recorded
the item as finished while activity_task_status stayed frozen at its last
heartbeat with end_time NULL. Nothing outside the process ever corrects that.
Editor::Shutdown tears down ...
Report DB failures on the status path instead of discarding themDBI is connected with a bare DSN and no attribute hash, so RaiseError is off:
a failed execute returns undef rather than throwing. _RunQueryBlocking handed
that undef to the row callback -- sub{} for every activity_task_status write --
and cached handles were never health-checked. A dropped posda_files connection
therefore turned every subsequent status update into a silent no-op for the
life o...
Write activity_task_status end_time before Finish's fallible workFinish() imported the report files, built downloadable files and sent the
inbox mail before it ever touched activity_task_status. Any failure in that
stretch -- and Report::_insert_report_file dies outright if the import does
not come back with a file id -- meant end_time was never set, so the UI kept
showing the task as running even though the work had completed.
Split the terminal update out...
Pull request #433: Feature/TADMIN-1661 develop collection dataset release moduleMerge in PT/oneposda from feature/TADMIN-1661-develop-collection-dataset-release-module to master
* commit '588774e3d24a01bd9fbf57d0fe3a6eeb8d4df4a4':
Stop duplicate files in the QC series file list, sort by geometry
Add the Disseminate backend: publish pages, attach manifests
Seed the module's lookup tables as a migration
Remove recordset_license and transfer_mode
Report per-file co...
Quiety down errors about missing Tokens when refreshingUnsure why this code path ever ends up here without a token being set,
but it is harmless and there's no need to log it.
New query for kaleidoscope unreivewed routeThe only one was using too much distinct and not using enough
tricks to try to keep things fast. If this works out it will also
be applied to the reviewed route.