mxcubecore.HardwareObjects.QueueModel#
Handles interaction with the data model(s). Adding, removing and retrieving nodes are all done via this object. It is possible to handle several models by using register_model and select_model.
Classes
|
|
|
- class mxcubecore.HardwareObjects.QueueModel.QueueModel(name)[source]#
Bases:
HardwareObject- add_child(parent, child: TaskNode) None[source]#
Adds the child node <child>. Raises the exception TypeError if child is not of type TaskNode.
Moves the child (re-parents it) if it already has a parent.
- Parameters:
child (TaskNode) – TaskNode to add
- Returns:
None
- Return type:
None
- add_child_at_id(_id: int, child: TaskNode) int[source]#
Adds a child <child> at the node with the node id <_id>
- check_for_path_collisions(new_path_template)[source]#
Returns True if there is a path template (task) in the model, that produces the same files as this one.
- Returns:
True if there is a potential path collision.
- clear_model(name: str | None = None) None[source]#
Clears the model with name <name>, clears all if name is None
- Parameters:
name (str | None) – The name of the model to clear.
- Returns:
None
- Return type:
None
- clear_queue()[source]#
Clears all models (ispyb, free-pin, plate) and resets the selected model to ‘ispyb’.
- del_child(parent, child: TaskNode) None[source]#
Removes <child>
- Parameters:
child (TaskNode) – Child to remove.
- Returns:
None
- Return type:
None
- get_next_run_number(new_path_template: PathTemplate, exclude_current: bool = True) int[source]#
Iterates through all the path templates of the tasks in the model and returns the next available run number for the path template <new_path_template>.
- get_node(_id: int, parent: TaskNode | None = None) TaskNode | None[source]#
Retrieves the node with the node id <_id>
- get_node_at_task_index(loc_str: str, tindex: int) TaskNode[source]#
Finds the node at position <tindex> in the task list of the sample with location string <loc_str>
- get_sample_by_loc_str(loc_str: str) Sample | None[source]#
Finds the Sample node with location string <loc_str>, directly under the selected model’s root.
- init()[source]#
Framework-2 method, inherited from HardwareObject and called by the framework after the object has been initialized.
You should normally not need to call this method.
- load_queue_from_file(filename, snapshot=None)[source]#
Loads queue from file. The problem is snapshots that are not stored in the file, so we have to add new ones in the loading process
- Returns:
model name ‘free-pin’, ‘ispyb’ or ‘plate’
- node_index(node)[source]#
Get the position (index) in the queue, sample and node id of node <node>.
- Returns:
dictionary on the form: {‘sample’: sample, ‘idx’: index, ‘queue_id’: node_id}
- queue_model_child_added(parent, child)[source]#
Listen to the addition of models to the queue model via the ‘child_added’ event.
This is the single place a QueueEntry is created for a model node:
Callers only ever call add_child() to place a model in the tree. Its not necassary to construct or enqueue an entry themselves.
This method handles the creation of a queue entry for every model type registred in mxcubecore.queue_entry.MODEL_QUEUE_ENTRY_MAPPINGS
- register_model(name: str, root_node: RootNode) None[source]#
Register a new model with name <name> and root node <root_node>.
- save_queue(filename=None)[source]#
Saves queue in the file. Current selected model is saved as a list of dictionaries. Information about samples and baskets is not saved
- select_model(name: str) None[source]#
Selects the model with the name <name>
- Parameters:
name (str) – The name of the model to select.
- Returns:
None
- Return type:
None