Class: Pipeline

Inherits:
ApplicationRecord show all
Includes:
BatchValidation, SharedBehaviour::Named, Uuid::Uuidable
Defined in:
app/models/pipeline.rb

Overview

Note:

Generally speaking we are trying to migrate pipelines out of the Sequencescape core.

A Pipeline acts to associate requests with a Workflow. Visiting a pipeline’s page will display an inbox of pending unbatched requests, and a summary list of ongoing batches for that particular pipeline. The users are able to generate new batches from the available requests and to from there progress a Batch through the associated workflow.

Defined Under Namespace

Modules: BatchValidation, GroupByParent, InboxExtensions, InboxGroupedBySubmission, RequestsInStorage Classes: GrouperByParent, GrouperByParentAndSubmission, GrouperBySubmission, GrouperForPipeline

Instance Method Summary collapse

Methods included from SharedBehaviour::Named

included

Methods included from BatchValidation

#validation_of_batch

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods inherited from ApplicationRecord

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Method Details

#all_requests_from_submissions_selected?(_request_ids) ⇒ Boolean

Returns:

  • (Boolean)


130
131
132
# File 'app/models/pipeline.rb', line 130

def all_requests_from_submissions_selected?(_request_ids)
  true
end

#completed_request_as_part_of_release_batch(request) ⇒ Object



110
111
112
# File 'app/models/pipeline.rb', line 110

def completed_request_as_part_of_release_batch(request)
  EventSender.send_request_update(request, 'complete', "Completed pipeline: #{name}")
end

#detach_request_from_batch(_batch, request) ⇒ Object

This is the old behaviour for every other pipeline.



91
92
93
94
95
# File 'app/models/pipeline.rb', line 91

def detach_request_from_batch(_batch, request)
  request.return_for_inbox!
  request.batch = nil
  request.save!
end

#extract_requests_from_input_params(params) ⇒ Object

Extracts the request ids from the selected requests. Overidden in pipleines which group by parent, as requests are grouped together by eg. submission id and labware id and the individual request ids are unavailable



125
126
127
128
# File 'app/models/pipeline.rb', line 125

def extract_requests_from_input_params(params)
  request_ids = params.fetch('request')
  requests.inputs(true).order(:id).find(selected_keys_from(request_ids))
end

#input_labware(_requests) ⇒ Object

Overridden in group-by parent pipelines to display input plates



98
99
100
# File 'app/models/pipeline.rb', line 98

def input_labware(_requests)
  Labware.none
end

#is_flowcell_type_consistent_for_batch?(_batch) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
# File 'app/models/pipeline.rb', line 86

def is_flowcell_type_consistent_for_batch?(_batch)
  true
end

#is_read_length_consistent_for_batch?(_batch) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
# File 'app/models/pipeline.rb', line 82

def is_read_length_consistent_for_batch?(_batch)
  true
end

#on_start_batch(batch, user) ⇒ Object



114
115
116
# File 'app/models/pipeline.rb', line 114

def on_start_batch(batch, user)
  # Do nothing
end

#output_labware(_requests) ⇒ Object

Overridden in group-by parent pipelines to display output



103
104
105
# File 'app/models/pipeline.rb', line 103

def output_labware(_requests)
  Labware.none
end

#pick_information?(_) ⇒ Boolean

Returns:

  • (Boolean)


157
158
159
# File 'app/models/pipeline.rb', line 157

def pick_information?(_)
  false
end

#post_finish_batch(batch, user) ⇒ Object



107
108
# File 'app/models/pipeline.rb', line 107

def post_finish_batch(batch, user)
end

#post_release_batch(batch, user) ⇒ Object



118
119
120
# File 'app/models/pipeline.rb', line 118

def post_release_batch(batch, user)
  # Do Nothing
end

#request_actionsObject



134
135
136
# File 'app/models/pipeline.rb', line 134

def request_actions
  [:fail]
end

#request_count_in_inbox(show_held_requests) ⇒ Object



153
154
155
# File 'app/models/pipeline.rb', line 153

def request_count_in_inbox(show_held_requests)
  requests.unbatched.pipeline_pending(show_held_requests).with_present_asset.count
end

#request_types_including_controlsObject



78
79
80
# File 'app/models/pipeline.rb', line 78

def request_types_including_controls
  [control_request_type].compact + request_types
end

#requests_in_inbox(show_held_requests = true) ⇒ Object



142
143
144
145
146
147
148
149
150
151
# File 'app/models/pipeline.rb', line 142

def requests_in_inbox(show_held_requests = true)
  apply_includes(
    requests
      .unbatched
      .pipeline_pending(show_held_requests)
      .with_present_asset
      .order(request_sort_order)
      .send(inbox_eager_loading)
  )
end

#robot_verified!(batch) ⇒ Object



138
139
140
# File 'app/models/pipeline.rb', line 138

def robot_verified!(batch)
  # Do nothing!
end