This commit is contained in:
@@ -302,7 +302,9 @@ class Eiger(PSIDeviceBase):
|
||||
start_time = time.time()
|
||||
timeout = 20
|
||||
for _ in range(timeout):
|
||||
if self.jfj_client.wait_for_idle(timeout=1, request_timeout=10):
|
||||
if self.jfj_client.wait_for_idle(
|
||||
timeout=1, request_timeout=10, raise_on_timeout=False
|
||||
):
|
||||
logger.info(f"Device {self.name} completed acquisition.")
|
||||
return
|
||||
logger.info(
|
||||
|
||||
@@ -165,7 +165,9 @@ class JungfrauJochClient:
|
||||
f"Error in JungFrauJochClient for device {self._parent_name} during stop: {content}"
|
||||
)
|
||||
|
||||
def wait_for_idle(self, timeout: int = 10, request_timeout: float | None = None) -> bool:
|
||||
def wait_for_idle(
|
||||
self, timeout: int = 10, request_timeout: float | None = None, raise_on_timeout: bool = True
|
||||
) -> bool:
|
||||
"""Wait for JungfrauJoch to be in Idle state. Blocking call with timeout.
|
||||
|
||||
Args:
|
||||
@@ -178,9 +180,17 @@ class JungfrauJochClient:
|
||||
try:
|
||||
self.api.wait_till_done_post(timeout=timeout, _request_timeout=request_timeout)
|
||||
except requests.exceptions.Timeout:
|
||||
raise TimeoutError(f"HTTP request timeout in wait_for_idle for {self._parent_name}")
|
||||
except Exception:
|
||||
if raise_on_timeout:
|
||||
raise TimeoutError(
|
||||
f"HTTP request timeout in wait_for_idle for {self._parent_name}."
|
||||
)
|
||||
return False
|
||||
except Exception as exc:
|
||||
content = traceback.format_exc()
|
||||
logger.debug(f"Waiting for device {self._parent_name} to become IDLE: {content}")
|
||||
if raise_on_timeout:
|
||||
raise JungfrauJochClientError(
|
||||
f"Error in wait_for_idle for {self._parent_name}: {content}"
|
||||
) from exc
|
||||
return False
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user