class DeepTest::Distributed::RemoteWorkerClient

Public Class Methods

new(options, test_server, failover_workers) click to toggle source
# File lib/deep_test/distributed/remote_worker_client.rb, line 4
def initialize(options, test_server, failover_workers)
  @failover_workers = failover_workers
  @options = options
  @test_server = test_server
end

Public Instance Methods

fail_over(method, exception) click to toggle source
# File lib/deep_test/distributed/remote_worker_client.rb, line 44
def fail_over(method, exception)
  @options.ui_instance.distributed_failover_to_local(method, exception)
  @worker_server = @failover_workers
end
failed_over?() click to toggle source
# File lib/deep_test/distributed/remote_worker_client.rb, line 49
def failed_over?
  @worker_server == @failover_workers
end
load_files(filelist) click to toggle source
# File lib/deep_test/distributed/remote_worker_client.rb, line 10
def load_files(filelist)
  @options.new_listener_list.before_sync

  t = Thread.new do
    @test_server.sync(@options)
    @worker_server = @test_server.spawn_worker_server(@options)
    @worker_server.load_files filelist
  end

  filelist.each {|f| load f}

  begin
    t.join
  rescue => e
    # The failover here doesn't invoke load_files on the failover_workers
    # because they will be LocalWorkers, which fork from the current 
    # process.  The fact that we depend in this here is damp...
    #
    fail_over("load_files", e)
  end
end
start_all() click to toggle source
# File lib/deep_test/distributed/remote_worker_client.rb, line 32
def start_all
  @worker_server.start_all
rescue => e
  raise if failed_over?
  fail_over("start_all", e)
  retry
end
stop_all() click to toggle source
# File lib/deep_test/distributed/remote_worker_client.rb, line 40
def stop_all
  @worker_server.stop_all
end