From 0ad001d71e11af6e167cb4e169f3d6c4d6c24bf6 Mon Sep 17 00:00:00 2001 From: David Perl Date: Thu, 17 Sep 2026 13:18:50 +0200 Subject: [PATCH 1/3] fix: don't wait for jfjoch cancellation --- src/aare/devices/jfjoch.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/aare/devices/jfjoch.py b/src/aare/devices/jfjoch.py index f6671a4d..063198eb 100644 --- a/src/aare/devices/jfjoch.py +++ b/src/aare/devices/jfjoch.py @@ -114,7 +114,7 @@ class JFJochWrapper: ) from e @needs_init - def cancel(self, on_init: bool = False, wait_for_done: bool = False): + def cancel(self, on_init: bool = False): try: self._api.cancel_post() except Exception as e: @@ -124,8 +124,6 @@ class JFJochWrapper: operation="POST", endpoint="cancel_post", ) from e - if wait_for_done: - self._api.wait_till_done_post(1) @needs_init def is_idle(self) -> bool: -- 2.54.0 From 93656f46f0e6340c90c948e9c8ee7e7a9fab30a9 Mon Sep 17 00:00:00 2001 From: David Perl Date: Thu, 17 Sep 2026 13:26:19 +0200 Subject: [PATCH 2/3] fix: make _safe_sample safer --- src/aare/daq/daq.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/aare/daq/daq.py b/src/aare/daq/daq.py index b7a792a1..428f1aa4 100644 --- a/src/aare/daq/daq.py +++ b/src/aare/daq/daq.py @@ -979,7 +979,10 @@ class AareDAQ: }, ) logger.warning("cleaning up detector state after failed operation...") - self._jfjoch.cancel(wait_for_done=True) + try: + self._jfjoch.cancel() + except JFJochCommunicationError as e: + logger.error(f"Failure sending cancellation to jfjoch: {e}") if sample is None or sample_id is None: logger.error(f"Error in {operation.value}: {error}") @@ -3093,14 +3096,13 @@ class AareDAQ: """ Return (sample, tell_connected, tell_error) without raising. """ + sample = self._cfg.current_sample try: - return self.sync_current_sample_from_tell(), True, None + self._devs.tell.get_state() + tell_connected, tell_error = True, None except TellCommunicationError as e: - return self._cfg.current_sample, False, str(e) - except Exception as e: - logger.warning(f"error in status sample info call: {e}", exc_info=True) - # Keep status flowing even if Tell code throws something unexpected - return self._cfg.current_sample, False, f"TELL unavailable: {e}" + tell_connected, tell_error = False, f"TELL unavailable: {e}" + return sample, tell_connected, tell_error def _aerotech_status(self) -> tuple[bool, str | None]: aerotech_ok = True -- 2.54.0 From 09df930fd39a8bd879da0b31eeb8971ffb6b29e5 Mon Sep 17 00:00:00 2001 From: David Perl Date: Thu, 17 Sep 2026 14:28:06 +0200 Subject: [PATCH 3/3] docs: add comment to timeout adjustment --- src/aare/daq/daq.py | 4 ++-- src/aare/daq/operations/mounting/service.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/aare/daq/daq.py b/src/aare/daq/daq.py index 428f1aa4..476fca10 100644 --- a/src/aare/daq/daq.py +++ b/src/aare/daq/daq.py @@ -3099,9 +3099,9 @@ class AareDAQ: sample = self._cfg.current_sample try: self._devs.tell.get_state() - tell_connected, tell_error = True, None + tell_connected, tell_error = True, None except TellCommunicationError as e: - tell_connected, tell_error = False, f"TELL unavailable: {e}" + tell_connected, tell_error = False, f"TELL unavailable: {e}" return sample, tell_connected, tell_error def _aerotech_status(self) -> tuple[bool, str | None]: diff --git a/src/aare/daq/operations/mounting/service.py b/src/aare/daq/operations/mounting/service.py index 0ff37778..b97ec726 100644 --- a/src/aare/daq/operations/mounting/service.py +++ b/src/aare/daq/operations/mounting/service.py @@ -152,6 +152,9 @@ class MountingService: self.ctx.deps.devs.tell.set_in_mount_position(True) def _unmount_current_sample(self, timeout: float = 60.0): + # Timeout here is reduced from the default 360s because an error should be caught by + # the retry handler later. If errors from this function are not propagated correctly + # (e.g. through _handle_operation_error) it may cause weird problems that appear as timeouts! self._prepare_mount_hardware() previous_sample = self.ctx.deps.cfg.current_sample if previous_sample is not None: -- 2.54.0