Class: Dynflow::Director::SequentialManager

Inherits:
Object
  • Object
show all
Defined in:
lib/dynflow/director/sequential_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_planObject (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

#worldObject (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

Returns:

  • (Boolean)


51
52
53
# File 'lib/dynflow/director/sequential_manager.rb', line 51

def done?
  @done
end

#finalizeObject



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_stepsObject



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_stepsObject



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

#runObject



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