fix: call jfjoch cancel in failed operation exception handler

This commit is contained in:
perl_d committed 2026-09-09 10:10:05 +02:00
1 parent f5ea31dceb
commit ace161590c
2 files changed
+6 -2

No files matched your search

+3 -1
View File
@@ -956,7 +956,7 @@ class AareDAQ:
sample_id = getattr(sample, "db_id", None)
logger.exception(
"Operation failed",
f"Operation {operation.value} failed with error {error}",
extra={
"operation": operation.value,
"event_type": str(event_type),
@@ -965,6 +965,8 @@ class AareDAQ:
"additional_comment": additional_comment,
},
)
logger.warning("cleaning up detector state after failed operation...")
self._jfjoch.cancel(wait_for_done=True)
if sample is None or sample_id is None:
logger.error(f"Error in {operation.value}: {error}")
+3 -1
View File
@@ -114,7 +114,7 @@ class JFJochWrapper:
) from e
@needs_init
def cancel(self, on_init: bool = False):
def cancel(self, on_init: bool = False, wait_for_done: bool = False):
try:
self._api.cancel_post()
except Exception as e:
@@ -124,6 +124,8 @@ 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: