bluesky_queueserver_api.zmq.REManagerAPI.re_pause

REManagerAPI.re_pause(option=None, *, lock_key=None)

Request Run Engine to pause currently running plan. The request fails if RE Worker environment does not exist or no plan is currently running. The request only initates the sequence of pausing the plan.

If deferred pause is requested past the last checkpoint of the plan, the plan is run to completion and the queue is stopped. The stopped queue can not be resumed using re_resume method, instead queue_start method should be used to restart the queue. Check manager_state status flag to determine if the queue is stopped ("idle" state) or Run Engine is paused ("paused" state).

The pause_pending status flag is set if pause request is successfully passed to Run Engine. It may take significant time for deferred pause to be processed. The flag is cleared once the pending pause request is processed (the plan is paused or plan is completed and the queue is stopped).

Parameters:
option: str (‘immediate’ or ‘deferred’, optional)

Pause the plan immediately (roll back to the previous checkpoint) or continue to the next checkpoint. Default: "deferred".

lock_key: str or None (optional)

The lock key enables access to the API when RE Manager environment is locked. If the parameter is not None, the key overrides the current lock key set by REManagerAPI.lock_key. See documentation on REMangerAPI.lock() for more information. Default: None.

Returns:
dict

Dictionary keys:

  • success: boolean - success of the request.

  • msg: str - error message in case the request is rejected by RE Manager.

Raises:
RequestTimeoutError, RequestFailedError, HTTPRequestError, HTTPClientError, HTTPServerError

All exceptions raised by send_request API.

Examples

# Synchronous code (0MQ, HTTP)
RM.re_pause()             # Initiate deferred pause
RM.re_pause("deferred")   # Initiate deferred pause
RM.re_pause("immediate")  # Initiate immediate pause

RM.wait_for_idle_or_paused()

RM.re_resume()
RM.re_stop()
RM.re_abort()
RM.re_halt()

# Asynchronous code (0MQ, HTTP)
await RM.re_pause()             # Initiate deferred pause
await RM.re_pause("deferred")   # Initiate deferred pause
await RM.re_pause("immediate")  # Initiate immediate pause

await RM.wait_for_idle_or_paused()

await RM.re_resume()
await RM.re_stop()
await RM.re_abort()
await RM.re_halt()