Class: Airflow::Runner::BaseRunner

Inherits:
Object
  • Object
show all
Includes:
Utils::Logger
Defined in:
lib/async_flow/runner.rb

Direct Known Subclasses

TaskRunner, WorkflowRunner

Instance Method Summary collapse

Methods included from Utils::Logger

#logger

Constructor Details

#initialize(definitions) ⇒ BaseRunner

Returns a new instance of BaseRunner.



31
32
33
34
35
36
# File 'lib/async_flow/runner.rb', line 31

def initialize(definitions)
  @poller = Poller.new(Persistence.workflow_runs)
  @executor = Executors::ThreadPoolExecutor.new(1)
  @definitions = definitions
  @mutex = Mutex.new
end

Instance Method Details

#run(reactor) ⇒ Object

should already run parallel with the main worker



39
40
41
42
43
# File 'lib/async_flow/runner.rb', line 39

def run(reactor)
  logger.info "starting runner #{self}"
  running!
  _loop(reactor)
end

#stopObject



45
46
47
48
49
# File 'lib/async_flow/runner.rb', line 45

def stop
  executor&.shutdown
  @running = false # TODO: Investigate why putting this on top does not stop the runner
  logger.info "runner #{self} stopped"
end