Class: Sisyphus::ForkingExecutionStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/sisyphus/forking_execution_strategy.rb

Defined Under Namespace

Classes: ChildProcess

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ ForkingExecutionStrategy

Returns a new instance of ForkingExecutionStrategy.



6
7
8
# File 'lib/sisyphus/forking_execution_strategy.rb', line 6

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/sisyphus/forking_execution_strategy.rb', line 4

def logger
  @logger
end

Instance Method Details

#execute(job, error_handler = ->{}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/sisyphus/forking_execution_strategy.rb', line 10

def execute(job, error_handler = ->{})
  if @child_pid = fork
    error_handler.call unless success?
  else
    perform job
  end
end