Class: Ruptr::Runner::Threaded
- Inherits:
-
Parallel
- Object
- Ruptr::Runner
- Parallel
- Ruptr::Runner::Threaded
- Defined in:
- lib/ruptr/runner.rb
Instance Attribute Summary
Attributes inherited from Parallel
Attributes inherited from Ruptr::Runner
#capture_output, #golden_store, #timing_store
Instance Method Summary collapse
Methods inherited from Parallel
default_parallel_jobs, #initialize
Methods inherited from Ruptr::Runner
class_from_env, #dispatch, #expected_processor_time, find_runner, from_env, #initialize, opts_from_env, #run_report, #run_sink
Constructor Details
This class inherits a constructor from Ruptr::Runner::Parallel
Instance Method Details
#dispatch_batch(batch, sink) ⇒ Object
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/ruptr/runner.rb', line 270 def dispatch_batch(batch, sink) pending_mtx = Mutex.new sink_mtx = Mutex.new pending_tcs = batch.test_cases [parallel_jobs, pending_tcs.size].min.times.map do Thread.new do # TODO: reduce locking overhead? while (tc = pending_mtx.synchronize { pending_tcs.shift }) sink_mtx.synchronize { sink.begin_case(tc) } tr = tc.run_result(self, batch.group_context) sink_mtx.synchronize { sink.finish_case(tc, tr) } end end end.each(&:join) end |