bluesky_queueserver_api.zmq.REManagerAPI.item_execute

REManagerAPI.item_execute(item, *, user=None, user_group=None, lock_key=None)

Immediately execute the submitted item. The item may be a plan or an instruction. The request fails if item execution can not be started immediately (RE Manager is not in IDLE state, RE Worker environment does not exist, etc.). If the request succeeds, the item is executed once. The item is never added to the queue. If the queue is in the LOOP mode, the executed item is not added to the back of the queue after completion. The API request does not alter the sequence of enqueued plans. The item is added to history after completion.

Parameters:
item: dict, BItem, BPlan or BInst

Dictionary of item parameters or an instance of BItem, BPlan or BInst representing a plan or an instruction.

user, user_group: str or None (optional)

User name and user group name used in the API request. The parameter values override the default user and user group names (accessible using user and user_group properties). The default user or user group name is used if the respective parameter is not specified or None. The parameters are ignored by the HTTP version of the API.

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:
response: dict

Dictionary keys:

  • success: boolean - success of the request.

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

  • qsize: int - the size of the queue.

  • item: dict, BItem, BPlan, BInst - the dictionary of item parameters.

Raises:
RequestTimeoutError, RequestFailedError, HTTPRequestError, HTTPClientError, HTTPServerError

All exceptions raised by send_request API.

Examples

# Synchronous code (0MQ, HTTP)
RM.item_execute(BPlan("count", ["det1"], num=10, delay=1))

# Asynchronous code (0MQ, HTTP)
await RM.item_execute(BPlan("count", ["det1"], num=10, delay=1))