Class: UnitHosting::Hadoop::ClusterManger
- Inherits:
-
Object
- Object
- UnitHosting::Hadoop::ClusterManger
- Defined in:
- lib/unit_hosting/hadoop/cluster_manager.rb
Instance Attribute Summary collapse
-
#clusters ⇒ Object
readonly
Returns the value of attribute clusters.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#master ⇒ Object
readonly
Returns the value of attribute master.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#slave ⇒ Object
readonly
Returns the value of attribute slave.
-
#slaves ⇒ Object
readonly
Returns the value of attribute slaves.
Instance Method Summary collapse
- #clear_vars ⇒ Object
-
#initialize(server_group) ⇒ ClusterManger
constructor
A new instance of ClusterManger.
- #update ⇒ Object
Constructor Details
#initialize(server_group) ⇒ ClusterManger
Returns a new instance of ClusterManger.
16 17 18 19 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 16 def initialize server_group @group = UnitHosting::VmGroup.load(server_group) update end |
Instance Attribute Details
#clusters ⇒ Object (readonly)
Returns the value of attribute clusters.
8 9 10 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 8 def clusters @clusters end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
8 9 10 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 8 def group @group end |
#master ⇒ Object (readonly)
Returns the value of attribute master.
8 9 10 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 8 def master @master end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
8 9 10 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 8 def nodes @nodes end |
#slave ⇒ Object (readonly)
Returns the value of attribute slave.
8 9 10 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 8 def slave @slave end |
#slaves ⇒ Object (readonly)
Returns the value of attribute slaves.
8 9 10 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 8 def slaves @slaves end |
Instance Method Details
#clear_vars ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 9 def clear_vars @nodes = nil @master = nil @slave = nil @clusters = Array.new @slaves = Array.new end |
#update ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/unit_hosting/hadoop/cluster_manager.rb', line 20 def update @vms = @group.vms clear_vars @vms.each do |instance_id,vm| @master = vm if vm.display_name == "master" @slave = vm if vm.display_name == "slave" @clusters << vm if vm.display_name == "slave-cluster" end @slaves = @clusters.clone @slaves << slave @nodes = @slaves.clone @nodes << @master end |