DAQ: now sending mounting and unmounting messages to database

This commit is contained in:
appleb_m committed 2026-04-24 11:15:57 +02:00
1 parent 761d78a918
commit 37b6755410
1 file changed
+12 -6
+12 -6
View File
@@ -290,10 +290,15 @@ class AareDAQ:
True if successful, False otherwise
"""
try:
previous_sample = self.sample
if previous_sample is not None and previous_sample.db_id is not None:
self.__aare.send_sample_event(previous_sample, SampleEventType.UNMOUNTING)
self.__set_state(BeamlineStateEnum.RobotSampleExchange)
if sample is not None and sample.db_id is not None:
self.__aare.send_sample_event(sample, SampleEventType.MOUNTING)
self.__mount(sample)
if previous_sample is not None and previous_sample.db_id is not None:
self.__aare.send_sample_event(previous_sample, SampleEventType.UNMOUNTED)
if sample is not None and sample.db_id is not None:
self.__aare.send_sample_event(sample, SampleEventType.MOUNTED)
self.save_screenshot_db(sample.db_id, f"{sample.db_id}_mounted")
@@ -886,12 +891,11 @@ class AareDAQ:
self.__devs.tell.check_enable_motion()
self.__devs.tell.wait_not_busy()
self.__devs.tell.set_in_mount_position(True)
previous_sample = self.__cfg.current_sample
if target is None:
logger.debug(f"Unmounting sample: {self.__cfg.current_sample} (address: {self.__cfg.current_sample.tell_address()})")
logger.debug(f"Unmounting sample: {previous_sample} (address: {previous_sample.tell_address()})")
try:
self.__devs.tell.unmount(wait=True, timeout=60.0)
if self.__cfg.current_sample is not None and self.__cfg.current_sample.db_id is not None:
self.__aare.send_sample_event(self.__cfg.current_sample, SampleEventType.UNMOUNTED)
self.__cfg.current_sample = target
except Exception as e:
raise UnmountingFailed(f"Failed to unmount: {e}")
@@ -899,12 +903,14 @@ class AareDAQ:
try:
#TODO: how to differentiate between mounting and unmounting fails
# during a typucal mount call as this is handled by Tell?
logger.debug(f"Mounting sample: {target} (address: {target.tell_address()})")
log_msg = f"Mounting sample: {target} (address: {target.tell_address()})"
if previous_sample is not None:
log_msg = (f"Unmounting sample: {previous_sample} (address: {previous_sample.tell_address()})\n "
f"and {log_msg}")
logger.debug(log_msg)
value = self.__devs.tell.mount(address=target.tell_address(), force=True, auto_unmount=True, read_dm=False,
wait=True, timeout=360.0)
self.__mount_failure_handler(value)
if self.__cfg.current_sample is not None and self.__cfg.current_sample.db_id is not None:
self.__aare.send_sample_event(self.__cfg.current_sample, SampleEventType.UNMOUNTED)
logger.info(f"Mount result: {value}")
self.__cfg.current_sample = target
except Exception as e: