class Dynflow::Executors::Parallel
Constants
- UnprocessableEvent
- Work
Public Class Methods
new(world, pool_size = 10)
click to toggle source
Calls superclass method
Dynflow::Executors::Abstract.new
# File lib/dynflow/executors/parallel.rb, line 39 def initialize(world, pool_size = 10) super(world) @core = Core.spawn name: 'parallel-executor-core', args: [world, pool_size], initialized: @core_initialized = Concurrent.future end
Public Instance Methods
event(execution_plan_id, step_id, event, future = Concurrent.future)
click to toggle source
# File lib/dynflow/executors/parallel.rb, line 58 def event(execution_plan_id, step_id, event, future = Concurrent.future) @core.ask([:handle_event, Event[execution_plan_id, step_id, event, future]]) future end
execute(execution_plan_id, finished = Concurrent.future)
click to toggle source
# File lib/dynflow/executors/parallel.rb, line 46 def execute(execution_plan_id, finished = Concurrent.future) @core.ask([:handle_execution, execution_plan_id, finished]).value! finished rescue Concurrent::Actor::ActorTerminated => error dynflow_error = Dynflow::Error.new('executor terminated') finished.fail dynflow_error unless finished.completed? raise dynflow_error rescue => e finished.fail e unless finished.completed? raise e end
initialized()
click to toggle source
# File lib/dynflow/executors/parallel.rb, line 68 def initialized @core_initialized end
terminate(future = Concurrent.future)
click to toggle source
# File lib/dynflow/executors/parallel.rb, line 63 def terminate(future = Concurrent.future) @core.tell([:start_termination, future]) future end