Class: Hasta::EmrNode
- Inherits:
-
Object
- Object
- Hasta::EmrNode
- Defined in:
- lib/hasta/emr_node.rb
Overview
Models the Amazon Data Pipeline configuration details for the EMR job that is being tested
Class Method Summary collapse
Instance Method Summary collapse
- #cache_files ⇒ Object
- #env ⇒ Object
- #id ⇒ Object
-
#initialize(attributes) ⇒ EmrNode
constructor
A new instance of EmrNode.
- #input_paths ⇒ Object
- #mapper ⇒ Object
- #output_path ⇒ Object
- #reducer ⇒ Object
Constructor Details
#initialize(attributes) ⇒ EmrNode
Returns a new instance of EmrNode.
63 64 65 |
# File 'lib/hasta/emr_node.rb', line 63 def initialize(attributes) @attributes = attributes end |
Class Method Details
.from_json(json, scheduled_start_time = Time.now) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hasta/emr_node.rb', line 9 def from_json(json, scheduled_start_time = Time.now) command_line = parse_step_line(json['step']) new( :id => json['id'], :input_paths => command_line['input'], :output_path => command_line['output'].first, :mapper => command_line['mapper'].first, :reducer => command_line['reducer'].first, :cache_files => command_line['cacheFile'], :env => command_line['cmdenv'], :scheduled_start_time => scheduled_start_time ) end |
Instance Method Details
#cache_files ⇒ Object
87 88 89 90 |
# File 'lib/hasta/emr_node.rb', line 87 def cache_files files = attributes[:cache_files] @cache_files ||= Hash[files.map { |value| interpolate(value).split('#').reverse }] end |
#env ⇒ Object
92 93 94 |
# File 'lib/hasta/emr_node.rb', line 92 def env @env ||= Hash[attributes[:env].map { |value| value.split('=') }] end |
#id ⇒ Object
67 68 69 |
# File 'lib/hasta/emr_node.rb', line 67 def id attributes[:id] end |
#input_paths ⇒ Object
71 72 73 |
# File 'lib/hasta/emr_node.rb', line 71 def input_paths @input_path ||= attributes[:input_paths].map { |path| interpolate(path) } end |
#mapper ⇒ Object
79 80 81 |
# File 'lib/hasta/emr_node.rb', line 79 def mapper attributes[:mapper] end |
#output_path ⇒ Object
75 76 77 |
# File 'lib/hasta/emr_node.rb', line 75 def output_path @output_path ||= interpolate(attributes[:output_path]) end |
#reducer ⇒ Object
83 84 85 |
# File 'lib/hasta/emr_node.rb', line 83 def reducer attributes[:reducer] end |