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

QueueModel(name)

Serializer()

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

add_child_at_id(_id, child)[source]#

Adds a child <child> at the node with the node id <_id>

Parameters:
  • _id (int) – The id of the parent node.

  • child (TaskNode) – The child node to add.

Returns:

The id of the child.

Return type:

int

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_model_root()[source]#
Returns:

The selected model root.

Return type:

TaskNode

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:

int

get_node(_id, parent=None)[source]#

Retrieves the node with the node id <_id>

Parameters:
  • _id (int) – The id of the node to retrieve.

  • parent (TaskNode) – parent node to search in.

Returns:

The node with the id <_id>

Return type:

TaskNode

get_path_templates()[source]#

Retrievies a list of all the path templates in the model.

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>.

Parameters:
  • name (str) – The name of the ‘new’ model.

  • root_node (RootNode) – The root of the model.

Returns:

None

Return type:

NoneType

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

set_parent(parent, child)[source]#

Sets the parent of the child <child> to <parent>

Parameters:
  • parent (TaskNode Object) – The parent.

  • child (TaskNode Object) – The child

view_created(view_item, task_model)[source]#

Method that should be called by the routine that adds the view <view_item> for the model <task_model>

Parameters:
  • view_item (ViewItem) – The view item that was added.

  • task_model (TaskModel) – The associated task model.

Returns:

None

Return type:

None