Class: HadoopMetrics::JobTracker

Inherits:
Object
  • Object
show all
Includes:
API
Defined in:
lib/hadoop_metrics/job_tracker.rb

Constant Summary collapse

NODE_TYPE =
'jt'
JSON_FILED_VALUES =
%W(SummaryJson AliveNodesInfoJson BlacklistedNodesInfoJson QueueInfoJson)

Constants included from API

API::GCNameMap, API::MegaByte

Instance Attribute Summary

Attributes included from API

#name

Instance Method Summary collapse

Methods included from API

#gc, #get_jmx, #initialize, #memory, #metrics, #query_jmx, #via_jmx

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HadoopMetrics::API

Instance Method Details

#fairscheduler_jobs(opts = {}) ⇒ Object



26
27
28
# File 'lib/hadoop_metrics/job_tracker.rb', line 26

def fairscheduler_jobs(opts = {})
  group_by('fairscheduler','jobs', get_column(opts), get_force(opts))
end

#fairscheduler_pools(opts = {}) ⇒ Object



22
23
24
# File 'lib/hadoop_metrics/job_tracker.rb', line 22

def fairscheduler_pools(opts = {})
  group_by('fairscheduler', 'pools', get_column(opts), get_force(opts))
end

#fairscheduler_running_tasks(opts = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/hadoop_metrics/job_tracker.rb', line 30

def fairscheduler_running_tasks(opts = {})
  fs = metrics(get_force(opts))['fairscheduler']
  return nil if fs.nil?

  targets = fs[get_target(opts)]
  return nil if targets.nil?

  each_tasks = {}
  targets.each { |target|
    name = target.first['name']
    each_tasks[name] ||= 0
    each_tasks[name] += target.last['runningTasks']
  }
  each_tasks
end

#infoObject



10
11
12
# File 'lib/hadoop_metrics/job_tracker.rb', line 10

def info
  query_jmx('hadoop:service=JobTracker,name=JobTrackerInfo', JSON_FILED_VALUES).first
end

#mapred(opts = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/hadoop_metrics/job_tracker.rb', line 14

def mapred(opts = {})
  disable_snake_case {
    group_by('mapred', 'jobtracker', 'hostName', get_force(opts)).each_pair { |k, v|
      return v.first
    }
  }
end