ruboozie 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/oozie_api.rb +6 -3
  2. data/lib/oozie_objects.rb +8 -0
  3. metadata +4 -4
data/lib/oozie_api.rb CHANGED
@@ -37,7 +37,8 @@ class OozieApi
37
37
  begin
38
38
  MultiJson.decode(response.body)
39
39
  rescue StandardError => e
40
- error = OozieException.new("#{response.headers['oozie-error-code']}: #{response.headers['oozie-error-message']}")
40
+ ex_message = response.headers['oozie-error-code'] ? "#{response.headers['oozie-error-code']}: #{response.headers['oozie-error-message']}": response.body
41
+ error = OozieException.new(ex_message)
41
42
  raise error
42
43
  end
43
44
  end
@@ -59,7 +60,8 @@ class OozieApi
59
60
  begin
60
61
  MultiJson.decode(response.body)
61
62
  rescue StandardError => e
62
- error = OozieException.new("#{response.headers['oozie-error-code']}: #{response.headers['oozie-error-message']}")
63
+ ex_message = response.headers['oozie-error-code'] ? "#{response.headers['oozie-error-code']}: #{response.headers['oozie-error-message']}" : response.body
64
+ error = OozieException.new(ex_message)
63
65
  raise error
64
66
  end
65
67
  end
@@ -83,7 +85,8 @@ class OozieApi
83
85
  begin
84
86
  MultiJson.decode(response.body)
85
87
  rescue StandardError => e
86
- error = OozieException.new("#{response.headers['oozie-error-code']}: #{response.headers['oozie-error-message']}")
88
+ ex_message = response.headers['oozie-error-code'] ? "#{response.headers['oozie-error-code']}: #{response.headers['oozie-error-message']}": response.body
89
+ error = OozieException.new(ex_message)
87
90
  raise error
88
91
  end
89
92
  end
data/lib/oozie_objects.rb CHANGED
@@ -35,6 +35,14 @@ class OozieJob < OozieObject
35
35
  OozieApi.kill_job(self.id)
36
36
  end
37
37
 
38
+ def finished?
39
+ !['RUNNING','PREP'].include?(self.status)
40
+ end
41
+
42
+ def failed?
43
+ ['SUSPENDED', 'KILLED', 'FAILED'].include?(self.status)
44
+ end
45
+
38
46
  def name; appName; end
39
47
  def path; appPath; end
40
48
  def console_url; consoleUrl; end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboozie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - dguttman
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-04-04 00:00:00 Z
19
+ date: 2012-04-05 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: httparty