Sha256: c6687c292fbc32f52fc70e4a3cd9d143bd4b773eaeefff7d14b7e1e8bfa8116e
Contents?: true
Size: 1.36 KB
Versions: 9
Compression:
Stored size: 1.36 KB
Contents
$: << File.join(File.dirname(__FILE__),'lib') require 'calculations' include Calculations # MyWorker defines the behaviour of workers. # Here is where the real processing takes place class MyWorker < ScbiMapreduce::Worker # starting_worker method is called one time at initialization # and allows you to initialize your variables def starting_worker # You can use worker logs at any time in this way: # $WORKER_LOG.info "Starting a worker" end # receive_initial_config is called only once just after # the first connection, when initial parameters are # received from manager def receive_initial_config(parameters) # Reads the parameters # You can use worker logs at any time in this way: # $WORKER_LOG.info "Params received" # save received parameters, if any # @params = parameters end # process_object method is called for each received object. # Be aware that objs is always an array, and you must iterate # over it if you need to process it independently # # The value returned here will be received by the work_received # method at your worker_manager subclass. def process_object(objs) # iterate over all objects received # objs.each do |obj| # convert to uppercase do_dummy_calculations # end # return objs back to manager return objs end def closing_worker end end
Version data entries
9 entries across 8 versions & 1 rubygems