Class: DTR::TestUnit::WorkerClub

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/dtr/test_unit/worker_club.rb

Constant Summary collapse

DEFAULT_RUN_TEST_TIMEOUT =

seconds

60

Instance Method Summary collapse

Instance Method Details

#graceful_shutdownObject

Performs a wait on all the currently running threads and kills any that take too long. It waits by ENV || 60 seconds



34
35
36
37
38
39
# File 'lib/dtr/test_unit/worker_club.rb', line 34

def graceful_shutdown
  while reap_dead_workers("shutdown") > 0
    DTR.info {"Waiting for #{workers.list.length} threads to finish, could take #{timeout} seconds."}
    sleep timeout / 60
  end
end

#start_thread(drb_runner, remote_runner) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/dtr/test_unit/worker_club.rb', line 24

def start_thread(drb_runner, remote_runner)
  thread = Thread.new(drb_runner, remote_runner) do |local, remote|
    local.run_test_on(remote)
  end
  thread[:started_on] = Time.now
  workers.add(thread)
end