Class: SSHKit::Runner::Group

Inherits:
Sequential show all
Defined in:
lib/core_ext/sshkit/runner/group.rb

Instance Attribute Summary collapse

Attributes inherited from Abstract

#backends

Instance Method Summary collapse

Methods inherited from Abstract

#active_backend, active_backend, #active_backend=, active_backend=, #send_cmd

Instance Attribute Details

#group_size=(value) ⇒ Object (writeonly)

Sets the attribute group_size

Parameters:

  • value

    the value to set the attribute group_size to.



5
6
7
# File 'lib/core_ext/sshkit/runner/group.rb', line 5

def group_size=(value)
  @group_size = value
end

Instance Method Details

#do_it(&block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/core_ext/sshkit/runner/group.rb', line 7

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

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

    sleep wait_interval
  end.flatten
end