mxcubecore.HardwareObjects.QueueManager#

QueueManager, handles the execution of the MxCuBE queue. It is implemented as a hardware object and is configured by an XML file. See the example of the XML configuration for more details.

The Queue manager acts as both the controller of execution and as the root/ container of the queue, note the inheritance from QueueEntryContainer. See the documentation for the queue_entry module for more information.

Classes

QueueManager(name)

class mxcubecore.HardwareObjects.QueueManager.QueueManager(name)[source]#

Bases: HardwareObject, QueueEntryContainer

clear() None[source]#

Clears the queue (removes all entries).

Returns:

None

Return type:

None

delete_entry_at(item_pos_list: list)[source]#

Deletes the queue entries at the given (sample_id, task_index) positions.

Parameters:

item_pos_list (list) – List of [sample_id, task_index] pairs. task_index may be None/”undefined” to refer to the sample entry itself.

disable(state: bool) None[source]#

Sets the disable state to <state>, disables the possibility to call execute if True enables if False.

Parameters:

state (bool) – The disabled state, True, False.

Returns:

None

Return type:

None

enable_entry(id_or_qentry: int | BaseQueueEntry | list, flag: bool)[source]#

Helper function that sets the enabled flag for one or more entries and their models.

Accepts a single item, or a list of items, where each item is either a model node id or a QueueEntry object.

Parameters:
  • id_or_qentry (int | BaseQueueEntry | list) – Node id, QueueEntry object, or a list of either.

  • flag (bool) – True for enabled False for disabled

enable_sample_entries(sample_id_list: list, flag: bool)[source]#

Sets the enabled flag for the entries of the samples in <sample_id_list>.

Parameters:
  • sample_id_list (list) – List of sample location strings.

  • flag (bool) – True for enabled, False for disabled.

enqueue(queue_entry: BaseQueueEntry) None[source]#

Method inherited from QueueEntryContainer, enqueues the QueueEntry object <queue_entry>.

Parameters:

queue_entry (BaseQueueEntry) – QueueEntry to add

Return type:

None

execute(entry: BaseQueueEntry | None = None)[source]#

Starts execution of the queue.

Runs the entire queue or a single entry (entry is set) as one “run” of the queue and manages the various states such as “running”, “paused” and “stopped”.

Parameters:

entry (BaseQueueEntry | None) – Optional, queue_entry to run

Raises:

RuntimeError, if the queue is already running when called

execute_entry(entry: BaseQueueEntry, use_async=False)[source]#

Executes the queue entry once the queue has been started <entry>.

Parameters:

entry (BaseQueueEntry) – The entry to execute.

Raises:

RuntimeError if the queue is not already running when called

Returns:

None

get_current_entry() BaseQueueEntry | None[source]#

Gets the currently executing QueueEntry.

Returns:

The currently executing QueueEntry:

Return type:

BaseQueueEntry | None

get_entry(node_id: int) tuple[source]#

Retrieve the model and the queue entry for the model node with id <node_id>.

Parameters:

node_id (int) – Node id of node to retrieve

Returns:

The tuple (model, entry)

Return type:

tuple

get_entry_status(node_id: int) tuple[source]#

Get the current execution status for the queue entry associated with the model node <node_id>.

Parameters:

node_id (int) – Node id of the model node, or None.

Returns:

(enabled, is_executed, is_running, status), where status is one of the QUEUE_ENTRY_STATUS values.

Return type:

tuple

get_entry_with_model(model: TaskNode, root_queue_entry=None) BaseQueueEntry | None[source]#

Find the entry with the data model model.

Parameters:

model (TaskNode) – The model to look for.

Returns:

The QueueEntry with the model <model>

Return type:

BaseQueueEntry | None

init()[source]#

‘public’ post-initialization method. Override as needed.

For ConfiguredObjects called after loading contained objects.

is_disabled() bool[source]#
Returns:

True if the queue is disabled, (calling execute will do nothing).

Return type:

bool

is_executing(node_id=None) bool[source]#
Returns:

True if the queue is executing otherwise False

Return type:

bool

is_paused() bool[source]#

Returns the pause state, see the method set_pause().

Return type:

bool

last_queue_node() dict[source]#

Gets the node index information for the node currently being executed.

Returns:

dict as returned by QueueModel.node_index, plus “node”.

Return type:

dict

pause(state: bool) None[source]#

Sets the queue in paused state <state> (and waits), paused if True running if False.

Parameters:

state (bool) – Paused if True running if False

Returns:

None

Return type:

None

set_auto_add_diff_plan(autoadd: bool)[source]#

Sets the auto add diffraction plan flag, and propagates it to the queue entries of all Characterisation nodes currently in the queue.

Parameters:

autoadd (bool) – True autoadd, False wait for user

set_current_entry(entry: BaseQueueEntry | None) None[source]#

Sets the currently executing QueueEntry to <entry>.

Parameters:

entry (BaseQueueEntry | None) – The entry.

Returns:

None

Return type:

None

set_pause(state: bool) None[source]#

Sets the queue in paused state <state>. Emits the signal queue_paused with the current state as parameter.

Parameters:

state (bool) – Paused if True running if False

Returns:

None

Return type:

None

stop() None[source]#

Stops the queue execution.

Returns:

None

Return type:

None

swap_task_entry(sid: str, ti1: int, ti2: int)[source]#

Swap order of two queue entries in the queue, with the same sample <sid> as parent.

Parameters:
  • sid (str) – Sample id

  • ti1 (int) – Position of task1 (old position)

  • ti2 (int) – Position of task2 (new position)

wait_for_pause_event() None[source]#

Wait for the queue to be set to running set_pause(False) or continue if it already was running.

Returns:

None

Return type:

None