Class: PoolParty::Pool

Inherits:
Base show all
Defined in:
lib/poolparty/pool.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#after_initialized, #initialize, #method_missing

Constructor Details

This class inherits a constructor from PoolParty::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PoolParty::Base

Instance Attribute Details

#auto_executeObject

Returns the value of attribute auto_execute.



4
5
6
# File 'lib/poolparty/pool.rb', line 4

def auto_execute
  @auto_execute
end

#debuggingObject

Returns the value of attribute debugging.



4
5
6
# File 'lib/poolparty/pool.rb', line 4

def debugging
  @debugging
end

#verboseObject

Returns the value of attribute verbose.



4
5
6
# File 'lib/poolparty/pool.rb', line 4

def verbose
  @verbose
end

#very_debuggingObject

Returns the value of attribute very_debugging.



4
5
6
# File 'lib/poolparty/pool.rb', line 4

def very_debugging
  @very_debugging
end

#very_verboseObject

Returns the value of attribute very_verbose.



4
5
6
# File 'lib/poolparty/pool.rb', line 4

def very_verbose
  @very_verbose
end

Instance Method Details

#cloud(name, &block) ⇒ Object



6
7
8
# File 'lib/poolparty/pool.rb', line 6

def cloud(name, &block)
  clouds[name.to_s] = Cloud.new(name.to_s, {:parent => self}, &block)
end

#cloudsObject



10
11
12
# File 'lib/poolparty/pool.rb', line 10

def clouds
  @clouds ||= {}
end

#cmd(commands, opts = {}) ⇒ Object

Run command/s on all nodes in the pool. Returns a hash in the form of => [{instance_id=>result]}



16
17
18
19
20
21
22
23
# File 'lib/poolparty/pool.rb', line 16

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

#runObject



34
35
36
37
38
39
# File 'lib/poolparty/pool.rb', line 34

def run
  clouds.each do |cloud_name, cld|
    puts "----> Starting to build cloud #{cloud_name}"
    cld.run
  end
end