houdah 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,6 +33,16 @@ Houdah has been tested with Hue 1.1.0. If you have it working with a later vers
33
33
  # get percent done for the most recent job
34
34
  client.jobs.first.percent_done
35
35
 
36
+ # print out info about each tracker
37
+ client.trackers.each { |t| puts "#{t.host}: #{t.failureCount} failures, #{t.tasks.length} active tasks" }
38
+
39
+ # get number of active / blacklisted trackers
40
+ client.status.numActiveTrackers
41
+ client.status.numBlacklistedTrackers
42
+
43
+ # get number of excluded nodes
44
+ client.status.numExcludedNodes
45
+
36
46
  # get the mapred.local.dir config variable for the most recent job
37
47
  puts client.jobs.first.config['mapred.local.dir']
38
48
 
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
3
  require 'rake/testtask'
4
- require 'rake/rdoctask'
4
+ require 'rdoc/task'
5
5
 
6
6
  Bundler::GemHelper.install_tasks
7
7
 
@@ -1,6 +1,7 @@
1
1
  require 'houdah/version'
2
2
  require 'houdah/client'
3
3
  require 'houdah/job'
4
+ require 'houdah/tracker'
4
5
 
5
6
  $:.unshift File.join(File.dirname(__FILE__), 'thrift')
6
7
  require 'jobtracker'
@@ -19,15 +19,28 @@ module Houdah
19
19
  ## Get jobs. Type can be :running, :completed, :killed, :failed, or :all
20
20
  def jobs(type=:running)
21
21
  results = case type
22
- when :running then call(:getRunningJobs)
23
- when :completed then call(:getCompletedJobs)
24
- when :failed then call(:getFailedJobs)
25
- when :killed then call(:getKilledJobs)
26
- else call(:getAllJobs)
27
- end
22
+ when :running then call(:getRunningJobs)
23
+ when :completed then call(:getCompletedJobs)
24
+ when :failed then call(:getFailedJobs)
25
+ when :killed then call(:getKilledJobs)
26
+ else call(:getAllJobs)
27
+ end
28
28
  results.jobs.map { |j| Job.new(self, j) }
29
29
  end
30
30
 
31
+ def trackers(type=:active)
32
+ results = case type
33
+ when :active then call(:getActiveTrackers)
34
+ when :blacklisted then call(:getBlacklistedTrackers)
35
+ when :all then call(:getAllTrackers)
36
+ end
37
+ results.trackers.map { |t| Tracker.new(self, t) }
38
+ end
39
+
40
+ def status
41
+ call :getClusterStatus
42
+ end
43
+
31
44
  def queues
32
45
  call :getQueues
33
46
  end
@@ -8,6 +8,7 @@ module Houdah
8
8
  def initialize(client, thrift_job)
9
9
  @client = client
10
10
  @thrift_job = thrift_job
11
+ @parsed_config = nil
11
12
  end
12
13
 
13
14
  ## Get the job's config XML
@@ -17,7 +18,7 @@ module Houdah
17
18
 
18
19
  ## Get the job's config, as a Hash
19
20
  def config
20
- Nokogiri::XML(config_xml).xpath("//property").inject({}) { |props, xprop|
21
+ @parsed_config ||= Nokogiri::XML(config_xml).xpath("//property").inject({}) { |props, xprop|
21
22
  props[xprop.xpath("./name").text] = xprop.xpath("./value").text
22
23
  props
23
24
  }
@@ -0,0 +1,20 @@
1
+ module Houdah
2
+
3
+ class Tracker
4
+ attr_reader :thrift_tracker
5
+
6
+ def initialize(client, thrift_tracker)
7
+ @client = client
8
+ @thrift_tracker = thrift_tracker
9
+ end
10
+
11
+ def tasks
12
+ @thrift_tracker.taskReports || []
13
+ end
14
+
15
+ def method_missing(method, *args)
16
+ @thrift_tracker.send method, *args
17
+ end
18
+ end
19
+
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Houdah
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: houdah
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Muller
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-06 00:00:00 -04:00
18
+ date: 2011-08-12 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - lib/houdah/client.rb
63
63
  - lib/houdah/job.rb
64
+ - lib/houdah/tracker.rb
64
65
  - lib/houdah/version.rb
65
66
  - lib/houdah.rb
66
67
  - lib/thrift/common_constants.rb