mxcubecore.HardwareObjects.QueueModel#
Handels interaction with the data model(s). Adding, removing and retreiving nodes are all done via this object. It is possbile 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)[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
- 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=None)[source]#
Clears the model with name <name>, clears all if name is None
- Parameters:
name (str) – The name of the model to clear.
- Returns:
None
- Return type:
NoneType
- copy_node(node)[source]#
Copys the node <node> and returns it.
- Parameters:
node (TaskModel) – The node to copy.
- Returns:
A copy of the node.
- Return type:
TaskModel
- del_child(parent, child)[source]#
Removes <child>
- Parameters:
child (TaskNode) – Child to remove.
- Returns:
None
- Return type:
None
- get_next_run_number(new_path_template, exclude_current=True)[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>.
- Parameters:
new_path_template (PathTemplate) – PathTempalte to match with.
exclude_current – Skips it self when iterating through the model, default Tree.
- Returns:
The next available run number for the given path_template.
- Return type:
- init()[source]#
Framework-2 method, inherited from HardwareObject and called by the framework after the object has been initialized.
You should normaly 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’
- register_model(name, root_node)[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)[source]#
Selects the model with the name <name>
- Parameters:
name (str) – The name of the model to select.
- Returns:
None
- Return type:
NoneType