Class: Ductwork::Step
- Inherits:
-
Record
- Object
- Record
- Ductwork::Step
- Defined in:
- lib/ductwork/models/step.rb
Class Method Summary collapse
Instance Method Summary collapse
- #context ⇒ Object
- #run_id ⇒ Object
-
#terminal_result_type ⇒ Object
The result_type of the most recent execution to finish for this step's job, used to distinguish why a step failed (e.g.
errored!writes "failure",crashed!writes "process_crashed").
Class Method Details
.build_for_execution(run_id) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/ductwork/models/step.rb', line 37 def self.build_for_execution(run_id, *, **) instance = allocate instance.instance_variable_set(:@run_id, run_id) instance.send(:initialize, *, **) instance end |
Instance Method Details
#context ⇒ Object
63 64 65 |
# File 'lib/ductwork/models/step.rb', line 63 def context @_context ||= Ductwork::Context.new(run_id) end |
#run_id ⇒ Object
46 47 48 |
# File 'lib/ductwork/models/step.rb', line 46 def run_id @run_id || (@attributes && super) end |
#terminal_result_type ⇒ Object
The result_type of the most recent execution to finish for this step's
job, used to distinguish why a step failed (e.g. errored! writes
"failure", crashed! writes "process_crashed"). Returns nil when no
execution has produced a result yet.
54 55 56 57 58 59 60 61 |
# File 'lib/ductwork/models/step.rb', line 54 def terminal_result_type return if job.blank? job.executions .joins(:result) .order(created_at: :desc) .pick("ductwork_results.result_type") end |