Class: DeepTest::LocalWorkers

Inherits:
Object
  • Object
show all
Defined in:
lib/deep_test/local_workers.rb

Direct Known Subclasses

Distributed::TestServerWorkers

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ LocalWorkers

Returns a new instance of LocalWorkers.



3
4
5
6
# File 'lib/deep_test/local_workers.rb', line 3

def initialize(options)
  @options = options
  @warlock = Warlock.new
end

Instance Method Details

#load_files(files) ⇒ Object



8
9
10
# File 'lib/deep_test/local_workers.rb', line 8

def load_files(files)
  files.each {|f| load f}
end

#number_of_workersObject



33
34
35
# File 'lib/deep_test/local_workers.rb', line 33

def number_of_workers
  @options.number_of_workers
end

#serverObject



12
13
14
# File 'lib/deep_test/local_workers.rb', line 12

def server
  @options.server
end

#start_allObject



16
17
18
19
20
21
22
23
24
25
26
27
# 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_allObject



29
30
31
# File 'lib/deep_test/local_workers.rb', line 29

def stop_all
  @warlock.stop_all
end