Class: SSHKit::Runner::Parallel
- Defined in:
- lib/sshkit/runners/parallel.rb
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
Methods inherited from Abstract
Constructor Details
This class inherits a constructor from SSHKit::Runner::Abstract
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sshkit/runners/parallel.rb', line 8 def execute threads = [] hosts.each do |host| threads << Thread.new(host) do |h| begin backend(h, &block).run rescue Exception => e e2 = ExecuteError.new e raise e2, "Exception while executing #{host.user ? "as #{host.user}@" : "on host "}#{host}: #{e.}" end end end threads.map(&:join) end |