Class: RSpec::MultiprocessRunner::Coordinator
- Inherits:
-
Object
- Object
- RSpec::MultiprocessRunner::Coordinator
- Defined in:
- lib/rspec/multiprocess_runner/coordinator.rb
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(worker_count, files, options = {}) ⇒ Coordinator
constructor
A new instance of Coordinator.
- #run ⇒ Object
- #shutdown(options = {}) ⇒ Object
Constructor Details
#initialize(worker_count, files, options = {}) ⇒ Coordinator
Returns a new instance of Coordinator.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rspec/multiprocess_runner/coordinator.rb', line 7 def initialize(worker_count, files, ={}) @worker_count = worker_count @file_timeout_seconds = [:file_timeout_seconds] @example_timeout_seconds = [:example_timeout_seconds] @log_failing_files = [:log_failing_files] @rspec_options = [:rspec_options] @spec_files = sort_files(files) @workers = [] @stopped_workers = [] end |
Instance Method Details
#failed? ⇒ Boolean
30 31 32 |
# File 'lib/rspec/multiprocess_runner/coordinator.rb', line 30 def failed? !failed_workers.empty? || !@spec_files.empty? || any_example_failed? end |
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rspec/multiprocess_runner/coordinator.rb', line 18 def run @start_time = Time.now expected_worker_numbers.each do |n| create_and_start_worker_if_necessary(n) end run_loop quit_all_workers print_summary !failed? end |
#shutdown(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rspec/multiprocess_runner/coordinator.rb', line 34 def shutdown(={}) if @shutting_down # Immediately kill the workers if shutdown is requested again end_workers_in_parallel(@workers.dup, :kill_now) else @shutting_down = true print "Shutting down #{pluralize(@workers.size, "worker")} …" if [:print_summary] # end_workers_in_parallel modifies @workers, so dup before sending in end_workers_in_parallel(@workers.dup, :shutdown_now) if [:print_summary] puts " done" print_summary end end end |