class SSHKit::Custom::Runner::Parallel
A runner which executes all commands in prallel (different threads).
Public Instance Methods
apply_block_to_bcks(&block)
click to toggle source
Executes all commands parallel @yields the actual host
# File lib/sshkit/custom/runner/parallel.rb, line 15 def apply_block_to_bcks(&block) futures = to_futures(&block) futures.each(&:value) end
thread_count()
click to toggle source
@api private
# File lib/sshkit/custom/runner/parallel.rb, line 21 def thread_count @thread_count ||= options[:thread_count] || Rake.suggested_thread_count - 1 end
thread_pool()
click to toggle source
@api private
# File lib/sshkit/custom/runner/parallel.rb, line 9 def thread_pool @thread_pool ||= Rake::ThreadPool.new(thread_count) end
to_futures(&block)
click to toggle source
@api private
# File lib/sshkit/custom/runner/parallel.rb, line 26 def to_futures(&block) backends.map do |b| thread_pool.future(b) do |fb| apply_to_bck fb, &block end end end