lib/hydra/master.rb in arturop-hydra-0.23.4 vs lib/hydra/master.rb in arturop-hydra-0.24.0
- old
+ new
@@ -1,10 +1,12 @@
require 'hydra/hash'
require 'open3'
require 'hydra/tmpdir'
+require 'hydra/proxy_config'
require 'erb'
require 'yaml'
+require 'hydra/threadsafe_io'
module Hydra #:nodoc:
# Hydra class responsible for delegate work down to workers.
#
# The Master is run once for any given testing session.
@@ -32,10 +34,13 @@
# * :verbose
# * Set to true to see lots of Hydra output (for debugging)
# * :autosort
# * Set to false to disable automatic sorting by historical run-time per file
def initialize(opts = { })
+
+ $stdout = ThreadsafeIO.new($stdout)
+
opts.stringify_keys!
config_file = opts.delete('config') { nil }
if config_file
begin
@@ -43,11 +48,11 @@
rescue Exception => e
raise(YmlLoadError,"config file was found, but could not be parsed with ERB.\n#{$!.inspect}")
end
begin
- config_yml = YAML::load(config_erb)
+ config_yml = ProxyConfig.load(config_erb)
rescue StandardError => e
raise(YmlLoadError,"config file was found, but could not be parsed.\n#{$!.inspect}")
end
opts.merge!(config_yml.stringify_keys!)
@@ -70,10 +75,11 @@
@runner_log_file = opts.fetch('runner_log_file') { nil }
@verbose = opts.fetch('verbose') { false }
@autosort = opts.fetch('autosort') { true }
@sync = opts.fetch('sync') { nil }
@environment = opts.fetch('environment') { 'test' }
+ @options = opts.fetch('options') { '' }
if @autosort
sort_files_from_report
@event_listeners << Hydra::Listener::ReportGenerator.new(File.new(heuristic_file, 'w'))
end
@@ -162,10 +168,10 @@
runners = worker.fetch('runners') { raise "You must specify the number of runners" }
trace "Booting local worker"
pipe = Hydra::Pipe.new
child = SafeFork.fork do
pipe.identify_as_child
- Hydra::Worker.new(:io => pipe, :runners => runners, :verbose => @verbose, :runner_listeners => @string_runner_event_listeners, :runner_log_file => @runner_log_file )
+ Hydra::Worker.new(:io => pipe, :runners => runners, :verbose => @verbose, :runner_listeners => @string_runner_event_listeners, :runner_log_file => @runner_log_file, :options => @options )
end
pipe.identify_as_parent
@workers << { :pid => child, :io => pipe, :idle => false, :type => :local }
end