Class: PipelineList

Inherits:
Object
  • Object
show all
Defined in:
app/models/pipeline_list.rb

Overview

A PipelineList contains all registered pipelines and is typically populated from config/pipelines/*.yml by ConfigLoader::PipelinesLoader during initialization.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list = {}) ⇒ PipelineList

Returns a new instance of PipelineList.



14
15
16
# File 'app/models/pipeline_list.rb', line 14

def initialize(list = {})
  @list = list.map { |pipeline_name, pipeline_config| Pipeline.new(pipeline_config.merge(name: pipeline_name)) }
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



7
8
9
# File 'app/models/pipeline_list.rb', line 7

def list
  @list
end

Instance Method Details

#active_pipelines_for(labware) ⇒ Object

Returns an array of all pipelines that are ‘active’ for a particular piece of labware. Normally, an ‘active’ pipeline is one where one or more active requests on the plate meet the filter criteria. If a pipeline has no filter criteria, it will also be considered ‘active’ for the labware.



22
23
24
# File 'app/models/pipeline_list.rb', line 22

def active_pipelines_for(labware)
  @list.select { |pipeline| pipeline.active_for?(labware) }
end

#combine_and_order_pipelines(pipeline_names) ⇒ Object

Builds a flat list of purposes in a sensible order from the relationships config Allowing the config hash to be in any order For example getting from this:

"LTHR Cherrypick" => [ "LTHR-384 RT-Q" ],
"LTHR-384 RT-Q" => [ "LTHR-384 PCR 1", "LTHR-384 PCR 2" ],
"LTHR-384 RT" => [ "LTHR-384 PCR 1", "LTHR-384 PCR 2" ],
"LTHR-384 PCR 1" => [ "LTHR-384 Lib PCR 1" ],
"LTHR-384 Lib PCR 1" => [ "LTHR-384 Lib PCR pool" ],
"LTHR-384 PCR 2" => [ "LTHR-384 Lib PCR 2" ],
"LTHR-384 Lib PCR 2" => [ "LTHR-384 Lib PCR pool" ]

To this:

[“LTHR Cherrypick”, “LTHR-384 RT”, “LTHR-384 RT-Q”, “LTHR-384 PCR 1”, “LTHR-384 PCR 2”, “LTHR-384 Lib PCR 1”, “LTHR-384 Lib PCR 2”, “LTHR-384 Lib PCR pool”]



52
53
54
55
56
57
58
# File 'app/models/pipeline_list.rb', line 52

def combine_and_order_pipelines(pipeline_names)
  pipeline_configs = @list.select { |pipeline| pipeline_names.include? pipeline.name }

  combined_relationships = extract_combined_relationships(pipeline_configs)

  flatten_relationships_into_purpose_list(combined_relationships)
end

#retrieve_pipeline_config_for_group(pipeline_group) ⇒ Object

For the given pipeline group return a object with key: group, and value: list of the pipeline names in that group e.g Chromium 3pv2”=>[“Bespoke Chromium 3pv2”, “Bespoke Chromium 3pv2 MX”]



29
30
31
# File 'app/models/pipeline_list.rb', line 29

def retrieve_pipeline_config_for_group(pipeline_group)
  @list.select { |pipeline| pipeline.pipeline_group == pipeline_group }.map(&:name)
end