Skip to content

Fvem 311 pause resume fastem acquistions - #3557

Draft
tepals wants to merge 3 commits into
delmic:masterfrom
tepals:FVEM-311-pause-resume-fastem-acquistions
Draft

Fvem 311 pause resume fastem acquistions#3557
tepals wants to merge 3 commits into
delmic:masterfrom
tepals:FVEM-311-pause-resume-fastem-acquistions

Conversation

@tepals

@tepals tepals commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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

tepals added 3 commits August 26, 2026 15:17
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.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 42 minutes.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c717d0e1-4dea-4e0c-9adc-bf0fed6d0a19

📥 Commits

Reviewing files that changed from the base of the PR and between 375c19a and 6fa5d38.

📒 Files selected for processing (9)
  • src/odemis/acq/fastem.py
  • src/odemis/acq/stitching/_tiledacq.py
  • src/odemis/gui/cont/acquisition/fastem_acq.py
  • src/odemis/gui/main_xrc.py
  • src/odemis/gui/util/widgets.py
  • src/odemis/gui/xmlh/resources/panel_tab_fastem_muti_beam.xrc
  • src/odemis/gui/xmlh/resources/panel_tab_fastem_setup.xrc
  • src/odemis/model/_futures.py
  • src/odemis/model/test/futures_test.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in CancellableFuture and freezes ProgressiveFuture progress 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.resume is missing an explicit return type; please add -> None for 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):
Comment on lines +266 to +267
executor = CancellableThreadPoolExecutor(max_workers=2)
executor.submitf(future, self.pausing_task, future)
Comment on lines +1696 to +1700
# 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,
)
Comment on lines +484 to +486
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants