class DeepTest::LocalWorkers
Public Class Methods
new(options)
click to toggle source
# File lib/deep_test/local_workers.rb, line 3 def initialize(options) @options = options @warlock = Warlock.new end
Public Instance Methods
load_files(files)
click to toggle source
# File lib/deep_test/local_workers.rb, line 8 def load_files(files) files.each {|f| load f} end
number_of_workers()
click to toggle source
# File lib/deep_test/local_workers.rb, line 33 def number_of_workers @options.number_of_workers end
server()
click to toggle source
# File lib/deep_test/local_workers.rb, line 12 def server @options.server end
start_all()
click to toggle source
# File lib/deep_test/local_workers.rb, line 16 def start_all each_worker do |worker_num| start_worker(worker_num) do reseed_random_numbers reconnect_to_database worker = DeepTest::Worker.new(worker_num, server, @options.new_listener_list) worker.run end end end
stop_all()
click to toggle source
# File lib/deep_test/local_workers.rb, line 29 def stop_all @warlock.stop_all end
Private Instance Methods
each_worker() { |worker_num| ... }
click to toggle source
# File lib/deep_test/local_workers.rb, line 51 def each_worker number_of_workers.to_i.times { |worker_num| yield worker_num } end
reconnect_to_database()
click to toggle source
# File lib/deep_test/local_workers.rb, line 39 def reconnect_to_database ActiveRecord::Base.connection.reconnect! if defined?(ActiveRecord::Base) end
reseed_random_numbers()
click to toggle source
# File lib/deep_test/local_workers.rb, line 47 def reseed_random_numbers srand end
start_worker(worker_num, &blk)
click to toggle source
# File lib/deep_test/local_workers.rb, line 43 def start_worker(worker_num, &blk) @warlock.start("worker #{worker_num}", &blk) end