Repository navigation
Keep GUI responsive during ICA runs - #190
Conversation
|
Claude finished @suraj-ranganath's task in 4m 38s —— View job Code reviewThis is a stacked PR; I scoped the review to the change this PR actually introduces (commit
The split of BlockingNone confirmed (see Important — I could not run a live multi-threaded repro in this sandbox). ImportantResult/progress callbacks almost certainly run on the worker thread, not the UI thread — The PR's central claim is "all worker.message.connect(lambda message: _update_progress_label(progress, label, message))
worker.succeeded.connect(on_success)
worker.failed.connect(on_error)In Qt, an
Both are exactly the off-main-thread GUI access this PR set out to avoid, and they tend to fail intermittently (sporadic segfaults) rather than in tests. Nothing in the helper marshals back to the GUI thread (no context object, no Suggested fix: anchor the result-handling connections to a main-thread Please verify empirically before merge, e.g. assert NitsNone. Test gaps
EEGLAB parity notesNone. Keeping console-invoked ICA synchronous ( |
Summary
This is a stacked PR targeting
origin/develop. It is built on top of the existing open stack, especially #177, and should not be merged before the earlier stacked PRs land.Implemented a reusable Qt long-task path and wired GUI-launched ICA through it so long
pop_runicaruns no longer freeze the main EEGPrep window.What changed
eegprep.functions.guifunc.long_task.run_long_task, a Qt worker-thread helper with an indeterminate progress dialog and EEGPrep log forwarding.pop_runicaGUI option collection from computation viapop_runica_gui_options(...), so the options dialog stays on the UI thread and only ICA computation runs in the worker.pop_runicathrough the long-task helper when launched from a Qt parent.EEGPrepSessionmutation on the main thread after worker success. Failed ICA runs leave EEG/session/history unchanged.eegprep-consolecommand/progress ordering by keeping the GUI-action boundary open until the background task finishes.pop_runicahelp, GUI/console workflow docs, and implementation notes.Verification
uv run --no-sync pytest tests/test_gui_long_task.py tests/test_gui_main_window.py::MenuActionDispatcherTests::test_gui_pop_runica_runs_ica_in_long_task_before_committing_result tests/test_gui_main_window.py::MenuActionDispatcherTests::test_gui_pop_runica_long_task_error_does_not_mutate_session tests/test_gui_pop_runica.pyuv run --no-sync pytest tests/test_gui_main_window.py tests/test_console_workspace.py::test_gui_action_without_command_releases_output_through_terminal_redraw tests/test_console_workspace.py::test_gui_pop_action_warning_output_follows_echoed_commandEEGPREP_SKIP_MATLAB=1 uv run --no-sync pytest -m "not slow"-> 1957 passed, 215 skipped, 12 deselecteduv run --no-sync ruff check .uv run --no-sync ruff format --check .uv run --no-sync ty check./pre-commit.py --changed-from origin/developNotes
The progress dialog is intentionally indeterminate because runica does not expose a reliable percentage. I did not add a Cancel button because cancellation would be fake until the ICA backends support safe interruption.