Class: Exec::Helper
- Inherits:
-
Object
- Object
- Exec::Helper
- Defined in:
- lib/exec/service_info.rb
Constant Summary collapse
- @@adoop_services_description =
{ "HDFS" => { "MASTER" => %w{NAMENODE SECONDARY_NAMENODE}, "SLAVE" => %w{DATANODE}, "MAPREDUCE" => { "MASTER" => %w{JOBTRACKER}, "SLAVE" => %w{TASKTRACKER}}, "HIVE" => { "MASTER" => %w{HIVE_SERVER}, "SLAVE" => []}, "HBASE" => { "MASTER" => %w{HBASE_MASTER}, "SLAVE" => %w{HBASE_REGIONSERVER}}, "ZOOKEEPER" => { "MASTER" => %w{ZOOKEEPER_SERVER}, "SLAVE" => []}, "OOZIE" => { "MASTER" => %w{OOZIE_SERVER}, "SLAVE" => []}, "NAGIOS" => { "MASTER" => %w{NAGIOS_SERVER}, "SLAVE" => []}, "GANGLIA" => { "MASTER" => %w{GANGLIA_SERVER}, "SLAVE" => []} } }
- @@component_status =
%w{INSTALLED STARTED MANTENANCE INIT}- @@component_transitional_status =
%w{INSTALLING STARTING STOPPING}
Class Method Summary collapse
- .get_all_component_name ⇒ Object
- .get_readable_components ⇒ Object
- .get_readable_service_desc(prefix = "\t") ⇒ Object
- .get_service_by_component_name(component_name) ⇒ Object
-
.get_service_components(service_name) ⇒ Object
Get the components of a service.
- .is_master_component?(component_name) ⇒ Boolean
- .is_transitional_status?(state) ⇒ Boolean
Class Method Details
.get_all_component_name ⇒ Object
300 301 302 303 304 305 306 307 308 |
# File 'lib/exec/service_info.rb', line 300 def self.get_all_component_name() all_components = [] @@adoop_services_description.each_value do |types| types.each_value do |component_names| all_components = all_components.concat(component_names) end end return all_components end |
.get_readable_components ⇒ Object
311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/exec/service_info.rb', line 311 def self.get_readable_components() all_components = "" @@adoop_services_description.each_value do |types| types.each_value do |component_names| component_names.each do |cn| all_components += " "+cn+"\n" end end end return all_components end |
.get_readable_service_desc(prefix = "\t") ⇒ Object
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/exec/service_info.rb', line 329 def self.get_readable_service_desc(prefix = "\t") output = "SERVICE_NAME (COMPONENT_LIST)\n" @@adoop_services_description.each do |service_name, component_type| output += prefix + service_name.to_s + "(" first = true list = component_type['MASTER'] list.concat(component_type['SLAVE']) list.each do |component_name| output += ", " unless first output += component_name.to_s first = false end output += ")\n" end return output end |
.get_service_by_component_name(component_name) ⇒ Object
290 291 292 293 294 295 296 297 |
# File 'lib/exec/service_info.rb', line 290 def self.get_service_by_component_name(component_name) @@adoop_services_description.each do |service_name, types| types.each_value do |component_names| return service_name if component_names.include?(component_name) end end return nil end |
.get_service_components(service_name) ⇒ Object
Get the components of a service.
285 286 287 |
# File 'lib/exec/service_info.rb', line 285 def self.get_service_components(service_name) return @@adoop_services_description[service_name] end |
.is_master_component?(component_name) ⇒ Boolean
271 272 273 274 275 276 277 278 279 280 |
# File 'lib/exec/service_info.rb', line 271 def self.is_master_component?(component_name) is_master = false @@adoop_services_description.each_value do |type| if type["MASTER"].include?(component_name) is_master = true break end end return is_master end |
.is_transitional_status?(state) ⇒ Boolean
TODO:
refactorise with same kind of function in ambari receiver…
324 325 326 |
# File 'lib/exec/service_info.rb', line 324 def self.is_transitional_status?(state) return @@component_transitional_status.include?(state) end |