Module: Qspec::Manager
- Included in:
- CommandLine
- Defined in:
- lib/qspec/manager.rb
Constant Summary collapse
- TIME_LOG_NAME =
'elapsed_time'
- DEFAULT_ELAPSED_TIME =
3.0
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/qspec/manager.rb', line 8 def id @id end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/qspec/manager.rb', line 7 def output @output end |
Instance Method Details
#start_worker ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/qspec/manager.rb', line 10 def start_worker @id = rand(10000) output.puts "ID: #{id}" register_files(id) if runnning_ports puts "Connecting to spork: #{runnning_ports.inspect}" runnning_ports.each do |port| fork do connect_spork(port, id, @configuration.error_stream, output) end end else puts "Forking #{@config['workers']} workers" command = "qspec #{@options.drb_argv.join " "}" @config['workers'].times do |i| env = { "qspec_id" => id.to_s, "TEST_ENV_NUMBER" => i == 0 ? '' : (i + 1).to_s } spawn(env, command, out: '/dev/null') end end @stats = [] thread = start_progress_thread(id) success = Process.waitall.all? { |pid, status| status.exitstatus == 0 } thread.exit pop_stat(id) output.puts "Failures: " if ipc.llen("failure_#{id}") > 0 each_object("failure_#{id}") do |failure| dump_failure(failure) end log_elapsed_times dump_summary exit(success ? 0 : 1) ensure if ipc ipc.del("to_run_#{id}") ipc.del("stat_#{id}") ipc.del("failure_#{id}") end end |