bluesky_queueserver_api.zmq.REManagerAPI.item_move_batch¶
- REManagerAPI.item_move_batch(*, uids=None, pos_dest=None, before_uid=None, after_uid=None, reorder=None, lock_key=None)¶
Move a batch of items to a different position in the queue. The batch is defined as a list of UIDs of included items. The UIDs in the list must be unique (not repeated) and items with listed UIDs must exist in the queue. If the list is empty, then operation succeeds and the queue remains unchanged. The destination must be specified using one of the mutually exclusive parameters
pos_dest
,before_uid
orafter_uid
. The item referred bybefore_uid
orafter_uid
must not be included in the batch. The parameterreorder
controls the order in which the moved items are placed in the queue: ifreorder
isFalse
(default), the order of items are defined by the order ofuids
list, otherwise the items are ordered by their original positions in the queue.- Parameters:
- uids: list(str)
List of UIDs of the items in the batch. The list may not contain repeated UIDs. All UIDs must exist in the queue. The list may be empty.
- pos_dest: str (“front” or “back”)
New position of the item. Only string values
'front'
and'back'
are accepted.- before_uid, after_uid: str or None
UID of an existing item in the queue. The selected item will be moved before or after this item. The item with the specified UID may not be included in the batch.
- reorder: boolean
Arrange moved items in the order of UIDs in the
uids
list (False, default) or according to the original item positions in the queue (True).- 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 - new size of the queue.items
: list(dict) - the list of moved items, which is[]
if the operation fails.
- Raises:
- RequestTimeoutError, RequestFailedError, HTTPRequestError, HTTPClientError, HTTPServerError
All exceptions raised by
send_request
API.
Examples
# Synchronous code (0MQ, HTTP) RM.item_move_batch(uids=["uid1", "uid2"], pos_dest="front") RM.item_move_batch(uids=["uid1", "uid2"], before_uid="uid-dest") # Asynchronous code (0MQ, HTTP) await RM.item_move_batch(uids=["uid1", "uid2"], pos_dest="front") await RM.item_move_batch(uids=["uid1", "uid2"], before_uid="uid-dest")