reduced restrictions on tasks to gracefully handle non-configured setups

This commit is contained in:
Nick Gauthier 2010-02-10 14:45:41 -05:00
parent bf9f918052
commit 951607cade
1 changed files with 4 additions and 9 deletions

View File

@ -65,8 +65,6 @@ module Hydra #:nodoc:
if @config if @config
@opts.merge!(:config => @config) @opts.merge!(:config => @config)
else else
$stderr.write "Hydra: No configuration file found at 'hydra.yml' or 'config/hydra.yml'\n"
$stderr.write "Hydra: Using default configuration for a single-core machine\n"
@opts.merge!(:workers => [{:type => :local, :runners => 1}]) @opts.merge!(:workers => [{:type => :local, :runners => 1}])
end end
@ -99,13 +97,11 @@ module Hydra #:nodoc:
@name = name @name = name
yield self if block_given? yield self if block_given?
@config = find_config_file @config = find_config_file
if @config
unless @config define
$stderr.write "No config file. Can't run a remote task without remote workers\n" else
return task "hydra:remote:#{@name}" do ; end
end end
define
end end
private private
@ -115,7 +111,6 @@ module Hydra #:nodoc:
config = YAML.load_file(@config) config = YAML.load_file(@config)
workers = config.fetch('workers') { [] } workers = config.fetch('workers') { [] }
workers = workers.select{|w| w['type'] == 'ssh'} workers = workers.select{|w| w['type'] == 'ssh'}
raise "No remote workers" if workers.empty?
workers.each do |worker| workers.each do |worker|
$stdout.write "==== Hydra Running #{@name} on #{worker['connect']} ====\n" $stdout.write "==== Hydra Running #{@name} on #{worker['connect']} ====\n"
ssh_opts = worker.fetch('ssh_opts') { '' } ssh_opts = worker.fetch('ssh_opts') { '' }