Fixes to avoid data loss#98
Open
deruyter92 wants to merge 4 commits into
Open
Conversation
… during recording When the user clicks "Stop pose inference" before "Stop recording", the processor instance was destroyed by reset() without saving its accumulated data. Later the recording stop flow would find no processor instance and silently skip the save. Now _stop_inference() saves processor data first if recording is still active, so data is preserved regardless of stop-button order.
`shutdown()` was skipping `_cleanup_processor()` when the worker thread stopped cleanly, leaving the custom processor's resources unreleased and its buffered data unsaved. This commit adds the missing `_cleanup_processor()` call before tearing down the DLCLive instance.
Stopping the DLC processor during a recording skips the processor's `on_recording_stopped` hook, which would normally handle legacy output copies and DB-compatible file alignment. Show a confirmation dialog when the user attempts to stop inference while recording is still active, recommending they stop recording first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two defensive fixes on the GUI side to prevent silently losing processor
outputs when the DLC processor shuts down before the recording-stopped
hook fires.
The custom processor plugin
dlc_inference_w_pd_syncsaves its legacyoutputs (PROC pickle, DLC HDF5, timestamp NPY) and performs DB-compatible
file copies through
on_recording_stopped().some non-standard ways of ending the experiment could bypass
this hook
Any
closeEvent: the shutdown skipped_cleanup_processor()when the worker threadstopped cleanly. After Fix thread crash in
TeensyLatency+ prevent data-loss fordlc_inference_w_pd_syncMMathisLab/FreelyMovingVR4Mice#329, the processor should now save it's own data when stopping. So cleanup of the processor is good here and safe.Stop inference while recording:
_stop_inference()stopsthe processor via
_dlc.reset()before the recording stops. When recording is later stopped,_notify_processor_recording_stopped()finds no processor instance.changes:
self._cleanup_processor()call in the clean-shutdownbranch of
shutdown(), so that processor resources are properly releasedand (with the processor-side fix) data is saved before the window closes.
QMessageBox.questiondialog now appears warning that legacy outputcopies will be skipped and recommending to stop recording first. If the
user proceeds anyway, the processor saves its core data through its own
stop()path. No prompt appears when recording is not active.