Sha256: b080ce4feeeef7a671dcb6e76598873fa5bd226c15d237cea5e982e333f195cf
Contents?: true
Size: 972 Bytes
Versions: 12
Compression:
Stored size: 972 Bytes
Contents
module PoolParty class Pool < Base attr_accessor :verbose, :very_verbose, :debugging, :very_debugging, :auto_execute def cloud(name, &block) clouds[name.to_s] = Cloud.new(name.to_s, {:parent => self}, &block) end def clouds @clouds ||= {} end # Run command/s on all nodes in the pool. # Returns a hash in the form of {cloud => [{instance_id=>result}]} def cmd(commands, opts={}) results = {} threads = clouds.collect do |name, c| Thread.new{ results[ name ] = c.cmd(commands, opts) } end threads.each{ |aThread| aThread.join } results end at_exit do if pool.auto_execute puts <<-EOE ----> Running #{pool.name} #{pool.auto_execute} EOE pool.run end end def run clouds.each do |cloud_name, cld| puts "----> Starting to build cloud #{cloud_name}" cld.run end end end end
Version data entries
12 entries across 12 versions & 1 rubygems