Fvem 311 pause resume fastem acquistions - #3557
Conversation
In addition to cancelling a future, this commit adds support for pausing and resuming a CancellableFuture. It is also extended to the ProgressiveFuture. To ensure the progress bar actually pauses, the widgets have been updated with a pause and resume functionality.
|
Warning Review limit reachedNext included review available in 42 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds pause/resume support for FAST-EM acquisitions by extending the Future model with pause semantics, wiring new Pause buttons into the GUI, and adding pause checkpoints in acquisition loops so pausing happens cleanly at tile/field boundaries.
Changes:
- Introduces
pause() / resume() / wait_if_paused()support inCancellableFutureand freezesProgressiveFutureprogress tracking while paused. - Adds Pause buttons and GUI controller logic for overview tiled acquisition and ROA acquisition flows (including disabling controls while awaiting the next safe pause point).
- Adds pause checkpoints in tiled acquisition/ROA field loops and adjusts tiled-average timing to exclude paused time; adds unit tests for pause/progress-freeze behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/odemis/model/test/futures_test.py | Adds unit tests for pause/resume and progress freezing on paused futures. |
| src/odemis/model/_futures.py | Implements pause/resume primitives in futures and freezes progress extrapolation while paused. |
| src/odemis/gui/xmlh/resources/panel_tab_fastem_setup.xrc | Adds a hidden Pause button for overview acquisition UI. |
| src/odemis/gui/xmlh/resources/panel_tab_fastem_muti_beam.xrc | Adds a hidden Pause button for ROA/multi-beam acquisition UI. |
| src/odemis/gui/util/widgets.py | Adds pause/resume controls to the progressive-future GUI connector timer. |
| src/odemis/gui/main_xrc.py | Wires new XRC Pause button controls into generated UI bindings. |
| src/odemis/gui/cont/acquisition/fastem_acq.py | Implements pause/resume UI behavior for overview and ROA acquisition controllers. |
| src/odemis/acq/stitching/_tiledacq.py | Inserts pause checkpoints between tiles and excludes paused time from average timing. |
| src/odemis/acq/fastem.py | Enables pausing ROA futures, blanks beam during pause, and propagates pause into tiled sub-acquisitions. |
Suppressed comments (2)
src/odemis/gui/util/widgets.py:317
ProgressiveFutureConnector.resumeis missing an explicit return type; please add-> Nonefor consistency and per project Python typing guidelines.
def resume(self):
src/odemis/model/test/futures_test.py:711
- These pause-freeze assertions use very small deltas after
sleep(1), which can be flaky on slower machines. Loosening the tolerance should keep the intent while reducing intermittent failures.
time.sleep(1)
elapsed_during, remaining_during = batch_future.get_progress()
self.assertAlmostEqual(elapsed_during, elapsed_at_pause, delta=0.05)
self.assertAlmostEqual(remaining_during, remaining_at_pause, delta=0.05)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| self._elapsed = elapsed_time | ||
| self._remaining = remaining_time | ||
|
|
||
| def pause(self): |
| executor = CancellableThreadPoolExecutor(max_workers=2) | ||
| executor.submitf(future, self.pausing_task, future) |
| # Find the currently running ROA sub-future that supports pause | ||
| running_future = next( | ||
| (f for f in self.acq_future.futures if f.running() and getattr(f, "can_pause", False)), | ||
| None, | ||
| ) |
| self.assertAlmostEqual(elapsed_after_resume, elapsed_at_pause + 0.2, delta=0.05) | ||
| # Remaining decreases by the same amount as elapsed increases | ||
| self.assertAlmostEqual(elapsed_after_resume + remaining_after_resume, 30.0, delta=0.05) |
Add pause and resume functionality to FAST-EM overview and ROA acquisitions. When pressing pause while the acquisition of a tile or field is ongoing, the buttons are disabled until that tile-/field-acquisition is done and the full acquisition pauses.
NOTE: during pausing the whole GUI is blocked, this still needs to be updated to allow specific actions during pausing such as moving the stage
Screencast.from.2026-08-26.15-37-07.webm