File: group.rb

package info (click to toggle)
ruby-sshkit 1.21.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 700 kB
  • sloc: ruby: 3,522; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module SSHKit

  module Runner

    class Group < Sequential
      attr_accessor :group_size

      def initialize(hosts, options = nil, &block)
        super(hosts, options, &block)
        @group_size = @options[:limit] || 2
      end

      def execute
        hosts.each_slice(group_size).collect do |group_hosts|
          Parallel.new(group_hosts, &block).execute
          sleep wait_interval
        end.flatten
      end

    end

  end

end