bluesky_queueserver_api.system_info_monitor.SystemInfoMonitor_ZMQ_Threads.next_msg
- SystemInfoMonitor_ZMQ_Threads.next_msg(timeout=None)
Returns the next message from the buffer. If
timeoutisNoneor zero, then the API returns the next available message. If the buffer contains no messages, the function waits for the next published message fortimeoutperiod and raisesRequestTimeoutErrorif no messages were received. Iftimeout is ``Noneor zero and the buffer contains no messages, then the function immediately raisesRequestTimeoutError.The returned message is a dictionary with two keys:
"time"(timestamp indicating time when the message was sent by RE Manager) and"msg"(dictionary with one key, the key indicates the message type, e.g."status", and the value is the information itself). For example:{"time": 1764605683.1407075, "msg": {"status": {<status info of RE Manager>}}}
- Parameters:
- timeout: float or None
If timeout is positive floating point number, zero or
None.
- Raises:
- RequestTimeoutError
No messages were no messages received during timeout period.
Examples
Synchronous API:
# Make sure RE Manager is started with option '--zmq-publish-console=ON' RM = REManagerAPI() RM.system_info_monitor.enable() # Run any command that generates console output RM.environment_open() RM.wait_for_idle() try: msg = RM.system_info_monitor.next_msg(timeout=1) print(msg["msg"]) except RM.RequestTimeoutError: pass RM.system_info_monitor.disable() RM.close()
Asynchronous API:
# Make sure RE Manager is started with option '--zmq-publish-console=ON' RM = REManagerAPI() RM.system_info_monitor.enable() # Run any command that generates console output await RM.environment_open() await RM.wait_for_idle() try: msg = await RM.system_info_monitor.next_msg(timeout=1) print(msg["msg"]) except RM.RequestTimeoutError: pass RM.system_info_monitor.disable() await RM.close()