Class: Hive::Scheduler

Inherits:
Worker
  • Object
show all
Defined in:
lib/hive/scheduler.rb

Instance Attribute Summary

Attributes inherited from Worker

#logger, #options

Instance Method Summary collapse

Methods inherited from Worker

#daemonize, #initialize, instance, #restart, run, #set_traps, #start, #start_console, #start_debugger, #start_drb, #start_logger, #stop

Constructor Details

This class inherits a constructor from Hive::Worker

Instance Method Details

#stop_tasksObject



10
11
12
13
14
15
16
17
18
# File 'lib/hive/scheduler.rb', line 10

def stop_tasks
  threads = Thread.list.select { |t| t.alive? && t != Thread.current }
  until threads.empty?
    logger.info "#{threads.size} threads still running ... "
    threads.each { |t| t.kill && t != Thread.current }
    threads = threads.select { |t| t.alive? }
  end
  logger.info "All threads are finished."
end