Class: Ductwork::Step
- Inherits:
-
Record
- Object
- Record
- Ductwork::Step
- Defined in:
- lib/ductwork/models/step.rb
Constant Summary collapse
- ADVANCEABLE_STATUSES =
The statuses that mean this step is done running and its branch is ready to be advanced:
advancing(the job succeeded) orfailed(the job exhausted its retry or crash budget). Shared by branch candidate selection, branch claiming, and the guard inBranch#advance!. %w[advancing failed].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build_for_execution(run_id, idempotency_key) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/ductwork/models/step.rb', line 43 def self.build_for_execution(run_id, idempotency_key, *, **) instance = allocate instance.instance_variable_set(:@run_id, run_id) instance.instance_variable_set(:@idempotency_key, idempotency_key) instance.send(:initialize, *, **) instance end |
Instance Method Details
#context ⇒ Object
68 69 70 |
# File 'lib/ductwork/models/step.rb', line 68 def context @_context ||= Ductwork::Context.new(run_id) end |
#idempotency_key ⇒ Object
55 56 57 |
# File 'lib/ductwork/models/step.rb', line 55 def idempotency_key @idempotency_key || (@attributes && id) end |
#run_id ⇒ Object
51 52 53 |
# File 'lib/ductwork/models/step.rb', line 51 def run_id @run_id || (@attributes && super) end |
#terminal_result_type ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/ductwork/models/step.rb', line 59 def terminal_result_type return if job.blank? job.executions .joins(:result) .order(created_at: :desc) .pick("ductwork_results.result_type") end |