Reputation: 96844
How would I pass parameters to my defined mapper
function in a mapreduce mapreduce_pipeline.MapreducePipeline
?
I am using a DatastoreInputReader
as input source. Usually, I only need a simple mapper function:
def mapper(model_entity_instance):
""" my mapper function """
But this time I would need something like:
def mapper(model_entity_instance, params_dict):
""" my mapper function """
How do I achieve this through the standard mapreduce
package?
Upvotes: 1
Views: 203
Reputation: 96844
Found a way:
from mapreduce import context
def mapper(model_entity_instance, params_dict):
""" my mapper function """
ctx=context.get()
mapper_params=ctx.mapreduce_spec.mapper.params
Upvotes: 4