fix(ddg): fix prepare_mcs_on_trigger method
CI for csaxs_bec / test (push) Failing after 1m25s

This commit is contained in:
2026-06-19 14:02:43 +02:00
parent 90b458813f
commit 00b769c724
@@ -364,7 +364,7 @@ class DDG1(PSIDeviceBase, DelayGeneratorCSAXS):
time.sleep(0.2)
logger.info(f"DDG {self.name} on_stage completed in {time.time() - start_time:.3f}s.")
def prepare_mcs_on_trigger(self, mcs: MCSCardCSAXS) -> None:
def prepare_mcs_on_trigger(self) -> CompareStatus:
"""
This method is used by the DDG1 on_trigger method to prepare the MCS card for the next trigger.
@@ -373,6 +373,12 @@ class DDG1(PSIDeviceBase, DelayGeneratorCSAXS):
It relies on the MCS card implementation and needs to be adapted if the MCS card logic changes.
"""
mcs_name = "mcs"
if self.device_manager is None or not hasattr(self.device_manager, "devices"):
raise ValueError("Device manager is not properly initialized.")
mcs = self.device_manager.devices.get(mcs_name, None)
if mcs is None:
raise ValueError(f"MCS card {mcs_name} not found in device manager.")
# NOTE First we wait that the MCS card is not acquiring. We add here a timeout of 5s to avoid
# a deadlock in case the MCS card is stuck for some reason. This should not happen normally.
@@ -588,7 +594,7 @@ class DDG1(PSIDeviceBase, DelayGeneratorCSAXS):
else:
start_time = time.time()
logger.debug(f"Preparing mcs card ")
status_mcs = self._prepare_mcs_on_trigger(mcs)
status_mcs = self._prepare_mcs_on_trigger()
# NOTE Timeout of 3s should be plenty, any longer wait should checked. If this happens to crash
# an acquisition regularly with a WaitTimeoutError, the timeout can be increased but it should
# be investigated why the EPICS interface is slow to respond.