Exception: Mandy::HadoopJobFailure

Inherits:
StandardError
  • Object
show all
Defined in:
lib/mandy/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, output) ⇒ HadoopJobFailure

Returns a new instance of HadoopJobFailure.



5
6
7
# File 'lib/mandy/errors.rb', line 5

def initialize(job, output)
  @job, @output = job, output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



3
4
5
# File 'lib/mandy/errors.rb', line 3

def output
  @output
end

Instance Method Details

#hadoop_errorObject



19
20
21
# File 'lib/mandy/errors.rb', line 19

def hadoop_error
  @output
end

#job_nameObject



9
10
11
# File 'lib/mandy/errors.rb', line 9

def job_name
  @job.name
end

#to_sObject



23
24
25
26
27
28
29
# File 'lib/mandy/errors.rb', line 23

def to_s
  output = []
  output << %(Mandy Job Name: #{job_name})
  output << %(Hadoop ERROR: #{hadoop_error})    
  output << %(Tracking URL: #{tracking_url}) if tracking_url
  output*"\n"
end

#tracking_urlObject



13
14
15
16
17
# File 'lib/mandy/errors.rb', line 13

def tracking_url
  line = @output.split("\n").find {|line| line =~ /Tracking URL/ }
  return nil unless line
  line.split('Tracking URL: ').last
end