Class: SSHKit::Custom::Config::Runner::Group

Inherits:
Abstract
  • Object
show all
Defined in:
lib/sshkit/custom/config/runner/group.rb

Instance Attribute Summary collapse

Attributes inherited from Abstract

#backends, #options

Instance Method Summary collapse

Methods inherited from Abstract

#active_backend, active_backend, active_backend=, #active_backend=, #apply_to_bck, create_runner, #initialize, scope, scope_storage, #send_cmd

Constructor Details

This class inherits a constructor from SSHKit::Custom::Config::Runner::Abstract

Instance Attribute Details

#group_sizeObject



23
24
25
# File 'lib/sshkit/custom/config/runner/group.rb', line 23

def group_size
  @group_size || options[:limit] || 2
end

Instance Method Details

#apply_block_to_bcks(&block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sshkit/custom/config/runner/group.rb', line 9

def apply_block_to_bcks(&block)
  backends.each_slice(group_size).collect do |group_backends|

    Parallel.new(nil, nil).tap do |runner|
      runner.backends = group_backends
      runner.apply_block_to_bcks(&block)
    end

    do_wait

  end.flatten
end