Class: Dynflow::Director::FinalizeWorkItem

Inherits:
WorkItem show all
Defined in:
lib/dynflow/director.rb

Constant Summary

Constants inherited from Serializable

Serializable::LEGACY_TIME_FORMAT, Serializable::TIME_FORMAT

Instance Attribute Summary collapse

Attributes inherited from WorkItem

#execution_plan_id, #queue, #sender_orchestrator_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WorkItem

#world, #world=

Methods inherited from Serializable

constantize, from_hash

Constructor Details

#initialize(execution_plan_id, queue, sender_orchestrator_id, finalize_steps_data = nil) ⇒ FinalizeWorkItem

Returns a new instance of FinalizeWorkItem.

Parameters:

  • finalize_steps_data (defaults to: nil)
    • used to pass the result steps from the worker back to orchestrator



136
137
138
139
# File 'lib/dynflow/director.rb', line 136

def initialize(execution_plan_id, queue, sender_orchestrator_id, finalize_steps_data = nil)
  super(execution_plan_id, queue, sender_orchestrator_id)
  @finalize_steps_data = finalize_steps_data
end

Instance Attribute Details

#finalize_steps_dataObject (readonly)

Returns the value of attribute finalize_steps_data.



133
134
135
# File 'lib/dynflow/director.rb', line 133

def finalize_steps_data
  @finalize_steps_data
end

Class Method Details

.new_from_hash(hash, *_args) ⇒ Object



152
153
154
# File 'lib/dynflow/director.rb', line 152

def self.new_from_hash(hash, *_args)
  self.new(*hash.values_at(:execution_plan_id, :queue, :sender_orchestrator_id, :finalize_steps_data))
end

Instance Method Details

#executeObject



141
142
143
144
145
146
# File 'lib/dynflow/director.rb', line 141

def execute
  execution_plan = world.persistence.load_execution_plan(execution_plan_id)
  manager = Director::SequentialManager.new(world, execution_plan)
  manager.finalize
  @finalize_steps_data = manager.finalize_steps.map(&:to_hash)
end

#to_hashObject



148
149
150
# File 'lib/dynflow/director.rb', line 148

def to_hash
  super.merge(finalize_steps_data: @finalize_steps_data)
end