Repository navigation
enh: pause button for the analysis (#9) - #27
Merged
Merged
Conversation
- `ChipStreamJobManager.pause` suspends all child processes (the dcnum worker processes) with psutil, as CSKernel does for postprocessing. A background thread also suspends child processes that dcnum starts while paused. `resume` resumes them, and `close` resumes before killing. The current job is shown as "paused" in the job list. - A checkable "Pause"/"Resume" button below "Run Pipeline" is shown while the analysis is running. During a run, the option group boxes and the run button are disabled individually (instead of the whole options panel), so that the pause button stays usable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27 +/- ##
==========================================
+ Coverage 80.08% 80.80% +0.71%
==========================================
Files 23 23
Lines 1622 1688 +66
==========================================
+ Hits 1299 1364 +65
- Misses 323 324 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
paulmueller
approved these changes
Nov 26, 2026
`test_gui_segm_torch_models_sorted` (DC-analysis#26) added copies of the test model with names that do not end with the MD5 sum ("Alpha.dcnm"), which dcnum rejects, and left their directory in the user settings. Every later ChipStream window preselected the machine-learning segmenter with "Alpha.dcnm", so the pipeline in `test_gui_pause_button` failed with "MD5 mismatch". - name the model copies "<name>_910c2.dcnm" and restore the "segm/torch_model_files" setting after the test - select the thresholding segmenter in `test_gui_pause_button` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paulmueller
approved these changes
Nov 26, 2026
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.
Closes #9.
Approach
As in CSKernel's postprocessing (
cskernel/postproc/pp_base.py,psutil.Process.suspend()for the subprocess and its children), the analysis is paused by suspending the dcnum worker processes. No change in dcnum is needed for this. Threads in the GUI process (job manager, dcnum runner) are not suspended; they just wait for the suspended processes.I tested this with the 30000-event Naiad reference dataset (DCOR
naiad-reference-data). I suspended all child processes for 60 s, resumed them, and compared the result with an unpaused run:deform,area_um,frame, pipeline hash)While paused, dcnum may start new processes: its worker starter thread runs in the GUI process, and so does the next job. These are suspended as well (see below).
Changes
ChipStreamJobManager.pause():NtSuspendProcesson Windows,SIGSTOPon POSIX)resume()is calledresume()resumes all suspended processes.close()(e.g. when the window is closed) resumes them before killing them.is_paused(); while paused, the current job's state in the job list is "paused".Caveats
Tests
test_manager_pause_resume: pauses before starting a job with worker processes (debug=False). After 10 s, the job is still busy and shown as "paused", all child processes are in thestoppedstate, and the progress does not change. Afterresume(), the job finishes ("done", progress 1).test_gui_pause_button: the button is only visible while running; clicking it pauses (button text "Resume") and clicking again resumes; after the run, the options are enabled again and the button is hidden.Both fail on
mainand pass with the change.tests/test_gui_manager.pyand the GUI tests for basic operation, expert settings, the model list, the status bar, and the pixel size pass. Intest_gui_expert_kwargs_invalid, the check that the options are still enabled now checks the run button (the options panel itself is no longer disabled).Follow-up: test isolation (second commit)
The first CI run failed in
test_gui_pause_button("MD5 mismatch for .../Alpha.dcnm"). The cause was not the pause itself buttest_gui_segm_torch_models_sortedfrom #26, which runs before it:Alpha.dcnm,beta.dcnm, etc. dcnum requires a model file name to end with the beginning of its MD5 sum (..._910c2.dcnm), so these files cannot be used for segmentation.ChipStreamwindow created afterwards preselects the "Machine-learning model" segmenter with the first sorted model (Alpha.dcnm), and any pipeline run in a later test fails. In enh: sort the list of segmentation models by name #26, no such test ran after it.Fix:
test_gui_segm_torch_models_sortednames the copies<name>_910c2.dcnmand restores thesegm/torch_model_filessetting afterwards.test_gui_pause_buttonselects the thresholding segmenter explicitly.Lint
lint-compareagainstmain: ruff 0 → 0, pyright 1.1.408 0 → 0, flake8 clean.🤖 Generated with Claude Code