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_uidmust 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 anduseranduser_groupparameters are set to the values provided as part of the request. Theuser_groupis also used for validation of submitted item. In case the existing item is replaced with a completely different item, set"replace": Trueto 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,BPlanorBInstrepresenting a plan or an instruction. The item parameteritem_uidmust 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
useranduser_groupproperties). The default user or user group name is used if the respective parameter is not specified orNone. 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 byREManagerAPI.lock_key. See documentation onREMangerAPI.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 orNoneif 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 submitteditem(with assigned UID) or None.
- Raises:
- RequestTimeoutError, RequestFailedError, HTTPRequestError, HTTPClientError, HTTPServerError
All exceptions raised by
send_requestAPI.
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)