class Hasta::Reducer

A wrapper for instantiating a reducer from a definition file and invoking it

Attributes

reducer_file[R]

Public Class Methods

new(reducer_file) click to toggle source
# File lib/hasta/reducer.rb, line 12
def initialize(reducer_file)
  @reducer_file = reducer_file
end

Public Instance Methods

reduce(execution_context, data_source, data_sink = InMemoryDataSink.new("Reducer Output")) click to toggle source
# File lib/hasta/reducer.rb, line 16
def reduce(execution_context, data_source, data_sink = InMemoryDataSink.new("Reducer Output"))
  Hasta.logger.debug "Starting reducer: #{reducer_file}"
  execution_context.execute(reducer_file, sorted_data_source(data_source), data_sink)

  data_sink.close
end

Private Instance Methods

sorted_data_source(data_source) click to toggle source
# File lib/hasta/reducer.rb, line 25
def sorted_data_source(data_source)
  SortedDataSource.new(data_source)
end