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

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)

143
144
145
# File 'app/models/pipeline.rb', line 143

def all_requests_from_submissions_selected?(_request_ids)
  true
end

#allow_tag_collision_on_tagging_task?Boolean

Returns:

  • (Boolean)

151
152
153
# File 'app/models/pipeline.rb', line 151

def allow_tag_collision_on_tagging_task?
  true
end

#completed_request_as_part_of_release_batch(request) ⇒ Object


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

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

#custom_messageObject


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

def custom_message
  # Override this in subclasses if you want to display a custom message in the _pipeline_limit partial
  # (blue box on pipeline show page)
  I18n.t('pipelines.show_page_custom_message.default')
end

#detach_request_from_batch(batch, request) ⇒ Object

This is the old behaviour for every other pipeline.


99
100
101
102
103
# File 'app/models/pipeline.rb', line 99

def detach_request_from_batch(batch, request)
  request.return_for_inbox!
  update_detached_request(batch, request)
  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


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

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

#has_controls?Boolean

Returns:

  • (Boolean)

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

def has_controls?
  !controls.empty?
end

#input_labware(_requests) ⇒ Object

Overridden in group-by parent pipelines to display input plates


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

def input_labware(_requests)
  Labware.none
end

#is_read_length_consistent_for_batch?(_batch) ⇒ Boolean

Returns:

  • (Boolean)

94
95
96
# File 'app/models/pipeline.rb', line 94

def is_read_length_consistent_for_batch?(_batch)
  true
end

#on_start_batch(batch, user) ⇒ Object


123
124
125
# File 'app/models/pipeline.rb', line 123

def on_start_batch(batch, user)
  # Do nothing
end

#output_labware(_requests) ⇒ Object

Overridden in group-by parent pipelines to display output


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

def output_labware(_requests)
  Labware.none
end

#pick_information?(_) ⇒ Boolean

Returns:

  • (Boolean)

174
175
176
# File 'app/models/pipeline.rb', line 174

def pick_information?(_)
  false
end

#post_finish_batch(batch, user) ⇒ Object


117
# File 'app/models/pipeline.rb', line 117

def post_finish_batch(batch, user); end

#post_release_batch(batch, user) ⇒ Object


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

def post_release_batch(batch, user)
  # Do Nothing
end

#request_actionsObject


147
148
149
# File 'app/models/pipeline.rb', line 147

def request_actions
  [:fail]
end

#request_count_in_inbox(show_held_requests) ⇒ Object


170
171
172
# File 'app/models/pipeline.rb', line 170

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

#request_types_including_controlsObject


90
91
92
# File 'app/models/pipeline.rb', line 90

def request_types_including_controls
  [control_request_type].compact + request_types
end

#requests_in_inbox(show_held_requests = true) ⇒ Object


159
160
161
162
163
164
165
166
167
168
# File 'app/models/pipeline.rb', line 159

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


155
156
157
# File 'app/models/pipeline.rb', line 155

def robot_verified!(batch)
  # Do nothing!
end

#update_detached_request(_batch, _request) ⇒ Object


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

def update_detached_request(_batch, _request); end