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.



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

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

Instance Method Details

#load_files(files) ⇒ Object



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

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

#number_of_workersObject



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

def number_of_workers
  @options.number_of_workers
end

#serverObject



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

def server
  @options.server
end

#start_all(s) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/deep_test/local_workers.rb', line 17

def start_all(s)
  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



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

def stop_all
  @warlock.stop_all
end