diff --git a/src/aare/daq/daq.py b/src/aare/daq/daq.py index b7a792a1..476fca10 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 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: 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: