Class: Dynflow::Executors::Parallel::FlowManager

Inherits:
Object
  • Object
show all
Includes:
Algebrick::TypeCheck
Defined in:
lib/dynflow/executors/parallel/flow_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(execution_plan, flow) ⇒ FlowManager

Returns a new instance of FlowManager.



9
10
11
12
13
14
# File 'lib/dynflow/executors/parallel/flow_manager.rb', line 9

def initialize(execution_plan, flow)
  @execution_plan = Type! execution_plan, ExecutionPlan
  @flow           = flow
  @cursor_index   = {}
  @cursor         = build_root_cursor
end

Instance Attribute Details

#cursor_indexObject (readonly)

Returns the value of attribute cursor_index.



7
8
9
# File 'lib/dynflow/executors/parallel/flow_manager.rb', line 7

def cursor_index
  @cursor_index
end

#execution_planObject (readonly)

Returns the value of attribute execution_plan.



7
8
9
# File 'lib/dynflow/executors/parallel/flow_manager.rb', line 7

def execution_plan
  @execution_plan
end

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/dynflow/executors/parallel/flow_manager.rb', line 16

def done?
  @cursor.done?
end

#startSet

Returns of steps to continue with.

Returns:

  • (Set)

    of steps to continue with



29
30
31
32
33
# File 'lib/dynflow/executors/parallel/flow_manager.rb', line 29

def start
  return @cursor.what_is_next.tap do |steps|
    raise 'invalid state' if steps.empty? && !done?
  end
end

#what_is_next(flow_step) ⇒ Set

Returns of steps to continue with.

Returns:

  • (Set)

    of steps to continue with



21
22
23
24
25
26
# File 'lib/dynflow/executors/parallel/flow_manager.rb', line 21

def what_is_next(flow_step)
  return [] if flow_step.state == :suspended

  success = flow_step.state != :error
  return cursor_index[flow_step.id].what_is_next(flow_step, success)
end