bluesky_queueserver_api.zmq.REManagerAPI.item_update

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

Update an existing item in the queue. The method may be used for modifying (editing) queue items or replacing the existing items with completely different items. The updated item may be a plan or an instruction. The item parameter item_uid must be set to a UID of an existing queue item that is replaced. The method fails if the item UID is not found. By default, the UID of the updated item is not changed and user and user_group parameters are set to the values provided as part of the request. The user_group is also used for validation of submitted item. In case the existing item is replaced with a completely different item, set "replace": True to tell the server to generate a new UID for the item (optional).

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. The item parameter item_uid must contain UID of one of the items in the queue.

replace: boolean

The server generates a new item UID before the item is inserted in the queue if True. Default: False.

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 queue 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 or None - new size of the queue or None if operation failed.

  • item: dict or None - a dictionary with parameters of the inserted item, including the assigned UID. If the request is rejected, the dictionary is a copy of the submitted item (with assigned UID) or None.

Raises:
RequestTimeoutError, RequestFailedError, HTTPRequestError, HTTPClientError, HTTPServerError

All exceptions raised by send_request API.

Examples

# Synchronous code (0MQ, HTTP)
RM.item_add(BPlan("count", ["det1"], num=10, delay=1), pos="back")
response = RM.item_get(pos="back")
item = BItem(response["item"])
item.kwargs["num"] = 50
RM.item_update(item)

# Asynchronous code (0MQ, HTTP)
await RM.item_add(BPlan("count", ["det1"], num=10, delay=1), pos="back")
response = await RM.item_get(pos="back")
item = BItem(response["item"])
item.kwargs["num"] = 50
await RM.item_update(item)