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
@opts.merge!(:config => @config)
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}])
end
@ -99,13 +97,11 @@ module Hydra #:nodoc:
@name = name
yield self if block_given?
@config = find_config_file
unless @config
$stderr.write "No config file. Can't run a remote task without remote workers\n"
return
end
if @config
define
else
task "hydra:remote:#{@name}" do ; end
end
end
private
@ -115,7 +111,6 @@ module Hydra #:nodoc:
config = YAML.load_file(@config)
workers = config.fetch('workers') { [] }
workers = workers.select{|w| w['type'] == 'ssh'}
raise "No remote workers" if workers.empty?
workers.each do |worker|
$stdout.write "==== Hydra Running #{@name} on #{worker['connect']} ====\n"
ssh_opts = worker.fetch('ssh_opts') { '' }