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

Constant Summary collapse

ALWAYS_SHOW_RELEASE_ACTIONS =

Override this in subclasses if you want to display action links for released batches

false

Instance Method Summary collapse

Methods included from SharedBehaviour::Named

included

Methods included from BatchValidation

#validation_of_batch, #validation_of_batch_for_completion

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

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#all_requests_from_submissions_selected?(_request_ids) ⇒ Boolean

Returns:

  • (Boolean)

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

def all_requests_from_submissions_selected?(_request_ids)
  true
end

#allow_tag_collision_on_tagging_task?Boolean

Returns:

  • (Boolean)

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

def allow_tag_collision_on_tagging_task?
  true
end

#completed_request_as_part_of_release_batch(request) ⇒ Object


117
118
119
120
121
122
123
124
125
126
# File 'app/models/pipeline.rb', line 117

def completed_request_as_part_of_release_batch(request)
  if library_creation?
    unless request.failed?
      EventSender.send_pass_event(request, '', "Passed #{name}.", id)
      EventSender.send_request_update(request, 'complete', "Completed pipeline: #{name}")
    end
  else
    EventSender.send_request_update(request, 'complete', "Completed pipeline: #{name}")
  end
end

#custom_messageObject


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

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.


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

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


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

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)

136
137
138
# File 'app/models/pipeline.rb', line 136

def has_controls?
  !controls.empty?
end

#input_labware(_requests) ⇒ Object

Overridden in group-by parent pipelines to display input plates


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

def input_labware(_requests)
  Labware.none
end

#is_read_length_consistent_for_batch?(_batch) ⇒ Boolean

Returns:

  • (Boolean)

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

def is_read_length_consistent_for_batch?(_batch)
  true
end

#on_start_batch(batch, user) ⇒ Object


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

def on_start_batch(batch, user)
  # Do nothing
end

#output_labware(_requests) ⇒ Object

Overridden in group-by parent pipelines to display output


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

def output_labware(_requests)
  Labware.none
end

#pick_information?(_) ⇒ Boolean

Returns:

  • (Boolean)

181
182
183
# File 'app/models/pipeline.rb', line 181

def pick_information?(_)
  false
end

#post_finish_batch(batch, user) ⇒ Object


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

def post_finish_batch(batch, user); end

#post_release_batch(batch, user) ⇒ Object


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

def post_release_batch(batch, user)
  # Do Nothing
end

#request_actionsObject


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

def request_actions
  [:fail]
end

#request_count_in_inbox(show_held_requests) ⇒ Object


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

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

#request_types_including_controlsObject


88
89
90
# File 'app/models/pipeline.rb', line 88

def request_types_including_controls
  [control_request_type].compact + request_types
end

#requests_in_inbox(show_held_requests = true) ⇒ Object


164
165
166
167
168
169
170
171
172
# File 'app/models/pipeline.rb', line 164

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


160
161
162
# File 'app/models/pipeline.rb', line 160

def robot_verified!(batch)
  # Do nothing!
end

#update_detached_request(_batch, _request) ⇒ Object


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

def update_detached_request(_batch, _request); end