Class: Dynflow::Director::SequentialManager
- Inherits:
-
Object
- Object
- Dynflow::Director::SequentialManager
- Defined in:
- lib/dynflow/director/sequential_manager.rb
Instance Attribute Summary collapse
-
#execution_plan ⇒ Object
readonly
Returns the value of attribute execution_plan.
-
#world ⇒ Object
readonly
Returns the value of attribute world.
Instance Method Summary collapse
- #done! ⇒ Object
- #done? ⇒ Boolean
- #finalize ⇒ Object
- #finalize_steps ⇒ Object
-
#initialize(world, execution_plan) ⇒ SequentialManager
constructor
A new instance of SequentialManager.
- #reset_finalize_steps ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(world, execution_plan) ⇒ SequentialManager
Returns a new instance of SequentialManager.
8 9 10 11 12 |
# File 'lib/dynflow/director/sequential_manager.rb', line 8 def initialize(world, execution_plan) @world = world @execution_plan = execution_plan @done = false end |
Instance Attribute Details
#execution_plan ⇒ Object (readonly)
Returns the value of attribute execution_plan.
6 7 8 |
# File 'lib/dynflow/director/sequential_manager.rb', line 6 def execution_plan @execution_plan end |
#world ⇒ Object (readonly)
Returns the value of attribute world.
6 7 8 |
# File 'lib/dynflow/director/sequential_manager.rb', line 6 def world @world end |
Instance Method Details
#done! ⇒ Object
47 48 49 |
# File 'lib/dynflow/director/sequential_manager.rb', line 47 def done! @done = true end |
#done? ⇒ Boolean
51 52 53 |
# File 'lib/dynflow/director/sequential_manager.rb', line 51 def done? @done end |
#finalize ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dynflow/director/sequential_manager.rb', line 23 def finalize reset_finalize_steps unless execution_plan.error? step_id = execution_plan.finalize_flow.all_step_ids.first action_class = execution_plan.steps[step_id].action_class world.middleware.execute(:finalize_phase, action_class, execution_plan) do dispatch(execution_plan.finalize_flow) end end @done = true end |
#finalize_steps ⇒ Object
35 36 37 38 39 |
# File 'lib/dynflow/director/sequential_manager.rb', line 35 def finalize_steps execution_plan.finalize_flow.all_step_ids.map do |step_id| execution_plan.steps[step_id] end end |
#reset_finalize_steps ⇒ Object
41 42 43 44 45 |
# File 'lib/dynflow/director/sequential_manager.rb', line 41 def reset_finalize_steps finalize_steps.each do |step| step.state = :pending if [:success, :error].include? step.state end end |
#run ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/dynflow/director/sequential_manager.rb', line 14 def run with_state_updates do dispatch(execution_plan.run_flow) finalize end return execution_plan end |