fix: added end_operation to the exception mess at the end of def measure() in daq.py

This commit is contained in:
appleb_m committed 2026-07-09 13:12:40 +02:00
1 parent dd265f1573
commit b96d125c65
1 file changed
+8 -3
+8 -3
View File
@@ -67,6 +67,7 @@ from aarecommon.models.rotation_scan import CompletedRotationScan, RotationScanR
from aarecommon.models.tell import TellPhaseEnum, TellStateModel
from aareDB import SampleEventType
from aare.common.models import DAQOperation
from aare.daq import workflows
from aare.daq.aaredb import AareWrapper
from aare.daq.config import ABR_POS_MOUNT, BeamlineConfig, BeamlineStateEnum
@@ -2599,7 +2600,7 @@ class AareDAQ:
def _end_operation(
self,
start,
start: float,
operation: Optional[DAQOperation] = DAQOperation.AUTOMATION,
error: bool = False,
) -> float:
@@ -2841,9 +2842,11 @@ class AareDAQ:
self._validate_automation_state(context="automation end")
except BECCommunicationError as e:
self._end_operation(start, operation=DAQOperation.AUTOMATION, error=True)
self._raise_if_critical_bec_error(e, command=getattr(e, "operation", None) or "bec")
except JFJochCommunicationError as e:
self._end_operation(start, operation=DAQOperation.AUTOMATION, error=True)
self._raise_if_critical_jfjoch_detector_error(e, command=e.endpoint or "unknown")
raise
@@ -2872,6 +2875,7 @@ class AareDAQ:
error=e,
event_type=SampleEventType.FAILED,
)
self._end_operation(start, operation=DAQOperation.AUTOMATION, error=True)
raise
except (BeamlineBusyTimeoutException, BeamlineBusyException) as e:
@@ -2906,12 +2910,13 @@ class AareDAQ:
error=e,
event_type=SampleEventType.FAILED,
)
self._end_operation(start, operation=None, error=True)
raise
except MountingFailed as e:
logger.error(f"Failed to mount sample: {e}")
if e.critical:
self._end_operation(start, operation=DAQOperation.AUTOMATION, error=True)
raise e
else:
pass
@@ -2937,7 +2942,7 @@ class AareDAQ:
error=e,
event_type=SampleEventType.FAILED,
)
self._end_operation(start, operation=DAQOperation.AUTOMATION, error=True)
raise Exception(f"Critical Error in automation: {e}") from e
self._record_completed_sample_time(progress, time.time() - sample_started_at)