Module: SimplerWorkflow::ParentProcess::ClassMethods

Defined in:
lib/simpler_workflow/parent_process.rb

Instance Method Summary collapse

Instance Method Details

#graceful_exit(s) ⇒ Object



54
55
56
57
58
# File 'lib/simpler_workflow/parent_process.rb', line 54

def graceful_exit(s)
  SimplerWorkflow.child_processes.each do |child| 
    Process.kill(s, child)
  end
end

#log_level(val) ⇒ Object



64
65
66
# File 'lib/simpler_workflow/parent_process.rb', line 64

def log_level(val)
  @log_level = val
end

#on_boot(&block) ⇒ Object



68
69
70
71
72
73
74
75
76
77
# File 'lib/simpler_workflow/parent_process.rb', line 68

def on_boot(&block)
    $logger.level = @log_level if @log_level
    # separate this execution in the log
    $logger.info "Booting with #{@workers} workers----------------------------"
    @workers.times { yield }
    # we wait for all children processes to exit; when QUIT is sent
    # we terminate them and this will automatically exit.
    Process.waitall
  
end

#workers(val) ⇒ Object



60
61
62
# File 'lib/simpler_workflow/parent_process.rb', line 60

def workers(val)
  @workers = val
end