Class: Hasta::Runner
- Inherits:
-
Object
- Object
- Hasta::Runner
- Defined in:
- lib/hasta/runner.rb
Overview
Runs a map/reduce job locally
Instance Attribute Summary collapse
-
#job_name ⇒ Object
readonly
Returns the value of attribute job_name.
Instance Method Summary collapse
-
#initialize(job_name, mapper, reducer = nil) ⇒ Runner
constructor
A new instance of Runner.
- #run(data_sources, data_sink, ruby_files = [], env = Hasta::Env.new) ⇒ Object
Constructor Details
#initialize(job_name, mapper, reducer = nil) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 15 |
# File 'lib/hasta/runner.rb', line 11 def initialize(job_name, mapper, reducer = nil) @job_name = job_name @mapper = mapper @reducer = reducer end |
Instance Attribute Details
#job_name ⇒ Object (readonly)
Returns the value of attribute job_name.
9 10 11 |
# File 'lib/hasta/runner.rb', line 9 def job_name @job_name end |
Instance Method Details
#run(data_sources, data_sink, ruby_files = [], env = Hasta::Env.new) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hasta/runner.rb', line 17 def run(data_sources, data_sink, ruby_files = [], env = Hasta::Env.new) Hasta.logger.debug "Starting Job: #{job_name}" context = ExecutionContext.new(ruby_files, env.setup) if reducer reducer.reduce(context, mapper.map(context, data_sources).data_source, data_sink) else mapper.map(context, data_sources, data_sink) end end |