Fix/dont wait for jfjoch cancel on cleanup #234

Merged
perl_d merged 3 commits from fix/dont_wait_for_jfjoch_cancel_on_cleanup into main 2026-09-17 14:31:09 +02:00
3 changed files with 13 additions and 10 deletions
+9 -7
View File
@@ -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
@@ -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:
+1 -3
View File
@@ -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: