bluesky_queueserver_api.zmq.REManagerAPI.item_move

REManagerAPI.item_move(*, pos=None, uid=None, pos_dest=None, before_uid=None, after_uid=None, lock_key=None)

Move an item to a different position in the queue. The parameters pos and uid are mutually exclusive. The parameters pos_dest, before_uid and after_uid are also mutually exclusive.

Parameters:
pos: str, int or None

Position of an item to be moved. The position may be positive or negative integer, "front" or "back". Negative positions are counted from the back of the queue. If the value is None (default), then the position is not specified.

uid: str or None

UID of the item to be moved. If None (default), then the parameter are not specified.

pos_dest: str, int or None

New position of the moved item: positive or negative integer, "front" or "back". If the value is None (default), then the position is not specified.

before_uid, after_uid: str or None

UID of an existing item in the queue. The selected item is moved before or after this item. If None (default), then the parameter are not specified.

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 - the size of the queue.

  • item: dict - a dictionary of parameters of the moved item, {} 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(pos="front", pos_dest="5")
RM.item_move(uid="uid-source", before_uid="uid-dest")

# Asynchronous code (0MQ, HTTP)
await RM.item_move(pos="front", pos_dest="5")
await RM.item_move(uid="uid-source", before_uid="uid-dest")