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 when manager_state status flag is "idle". Polling period is determined by status_polling_period parameter of REManagerAPI. The function raises WaitTimeoutError if timeout occurs or WaitCancelError if wait operation was cancelled by monitor.cancel() (see documentation on WaitMonitor class).

The synchronous version of wait_for_idle is 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 WaitMonitor object. The object is created internally if the parameter is None.

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 >