mxcubecore.queuelib.builder#

QueueBuilder: constructs queue model nodes (and, indirectly, their matching QueueEntry objects - see QueueModel.queue_model_child_added) from client task data.

Classes

QueueBuilder()

Creates queue models the creation of queue entries are handled in queue_model_child_added event handler

class mxcubecore.queuelib.builder.QueueBuilder[source]#

Bases: object

Creates queue models the creation of queue entries are handled in queue_model_child_added event handler

add_characterisation(node_id: int, task: dict) → int[source]#

Add a data characterisation task to the sample with id: <id>.

Parameters:
  • node_id (int) – id of the sample to which the task belongs

  • task (dict) – Task data (parameters)

Returns:

The queue id of the Data collection

Return type:

int

add_data_collection(node_id: int, task: dict) → int[source]#

Add a data collection task to the sample with id: <id>.

Parameters:
  • node_id (int) – id of the sample to which the task belongs

  • task (dict) – task data

Returns:

The queue id of the data collection

Return type:

int

add_energy_scan(node_id: int, task: dict) → int[source]#

Add a energy scan task to the sample with id: <id>.

Parameters:
  • node_id (int) – id of the sample to which the task belongs

  • task (dict) – task data

Returns:

The queue id of the data collection

Return type:

int

add_interleaved(node_id: int, task: dict) → int[source]#

Add a interleaved data collection task to the sample with id: <id>.

Parameters:
  • node_id (int) – id of the sample to which the task belongs

  • task (dict) – task data

Returns:

The queue id of the data collection

Return type:

int

add_queue_entry(node_id: int, task: dict, task_name: str)[source]#

Add a queue entry to the sample with id <node_id>.

Parameters:
  • node_id (int) – id of the sample to which the task belongs

  • task (dict) – task data

  • task_name (str) – The task name

add_sample(sample_id: str, item)[source]#

Add a sample with sample id <sample_id> the queue.

Parameters:

sample_id (str) – Sample id (often sample changer location)

Returns:

SampleQueueEntry

add_workflow(node_id: int, task: dict) → int[source]#

Add a worklfow task to the parent node with id: <id>.

For adding GPhL Auto workflow, call with node_id==parent_node_id and all required parameters in task[“parameters”]

Parameters:
  • node_id (int) – id of the parent node to which the task belongs

  • task (dict) – task data

Returns:

The queue id of the data collection

Return type:

int

add_xrf_scan(node_id: int, task: dict) → int[source]#

Add a XRF Scan task to the sample with id: <id>.

Parameters:
  • node_id (int) – id of the sample to which the task belongs

  • task (dict) – task data

Returns:

The queue id of the data collection

Return type:

int

get_default_prefix(sample_data, generic_name=False)[source]#

Thin pass-through to HWR.beamline.session.get_default_prefix.

Kept as its own method (rather than called inline) so apply_template can call it as self.get_default_prefix(…).

get_default_subdir(sample_data)[source]#

Thin pass-through to HWR.beamline.session.get_default_subdir.

set_char_params(model: Characterisation, entry: BaseQueueEntry, task_data: dict, sample_model)[source]#

Helper method that sets the characterisation parameters.

Helper method that sets the characterisation parameters for a Characterisation.

Parameters:
set_dc_params(model: DataCollection, entry: BaseQueueEntry, task_data: dict, sample_model)[source]#

Helper method that sets the data collection parameters for a DataCollection.

Parameters:
  • model (DataCollection) – The model to set parameters of

  • entry (BaseQueueEntry) – The queue entry of the model

  • task_data (dict) – Dictionary with new parameters

set_energy_scan_params(model: EnergyScan, entry: BaseQueueEntry, task_data: dict, sample_model)[source]#

Helper method that sets the xrf scan parameters for a XRF spectrum Scan.

Parameters:
  • model (EnergyScan) – The model to set parameters of

  • entry (BaseQueueEntry) – The queue entry of the model

  • task_data (dict) – Dictionary with new parameters

set_gphl_wf_params(model: GphlWorkflow, entry: BaseQueueEntry, task_data: dict, sample_model)[source]#

Helper method that sets the parameters for a GPhL workflow task.

Parameters:
  • model (GphlWorkflow) – The model to set parameters of

  • entry (BaseQueueEntry) – The queue entry of the model

  • task_data (dict) – Dictionary with new parameters

  • sample_model – The Sample queueModelObject

set_wf_params(model: Workflow, entry: BaseQueueEntry, task_data: dict, sample_model)[source]#

Helper method that sets the parameters for a workflow task.

Parameters:
  • model (Workflow) – The model to set parameters of

  • entry (BaseQueueEntry) – The queue entry of the model

  • task_data (dict) – Dictionary with new parameters

set_xrf_params(model: XRFSpectrum, entry: BaseQueueEntry, task_data: dict, sample_model)[source]#

Helper method that sets the xrf scan parameters for a XRF spectrum Scan.

Parameters:
  • model (XRFSpectrum) – The model to set parameters of

  • entry (BaseQueueEntry) – The queue entry of the model

  • task_data (dict) – Dictionary with new parameters

strip_prefix(pt, prefix)[source]#

Strip the reference, wedge and mad prefix from a given prefix.

For example, remove ref- from the beginning and _w[n] and -pk, -ip, -ipp from the end.

Parameters:
  • pt (PathTemplate) – path template used to create the prefix

  • prefix (str) – prefix from the client

Returns:

stripped prefix