bluesky_queueserver_api.zmq.REManagerAPI.wait_for_idle
- REManagerAPI.wait_for_idle(*, timeout=600, monitor=None)
Wait for RE Manager to return to
"idle"state. The function performs periodic polling of RE Manager status and returns whenmanager_statestatus flag is"idle". Polling period is determined bystatus_polling_periodparameter ofREManagerAPI. The function raisesWaitTimeoutErrorif timeout occurs orWaitCancelErrorif wait operation was cancelled bymonitor.cancel()(see documentation onWaitMonitorclass).The synchronous version of
wait_for_idleis threadsafe. Multiple instances may run simultanously in multiple threads (sync) or tasks (async). Results of polling RE Manager status are shared between multiple running instances.- Parameters:
- timeout: float
Timeout for the wait operation. Default timeout: 60 seconds.
- monitor: bluesky_queueserver_api.WaitMonitor or None
Instance of
WaitMonitorobject. The object is created internally if the parameter isNone.
- Returns:
- None
- Raises:
- REManagerAPI.WaitTimeoutError, REManagerAPI.WaitCancelError
The manager did not switch to ‘idle’ state during the timeout period or wait was cancelled using
monitor.cancel().
Examples
# Synchronous code (0MQ, HTTP) RM.queue_start() try: RM.wait_for_idle(timeout=120) # Wait for 2 minutes # The queue is completed or stopped, RE Manager is idle. except RM.WaitTimeoutError: # < process timeout error, RE Manager is probably not idle > # Aynchronous code (0MQ, HTTP) await RM.queue_start() try: await RM.wait_for_idle(timeout=120) # Wait for 2 minutes # The queue is completed or stopped, RE Manager is idle. except RM.WaitTimeoutError: # < process timeout error, RE Manager is probably not idle >