I want to declare a mapper function with mrjob. Because my mapper function needs to refer to some constants to do some calculations so I decide to put these constants into the Key in the mapper (Is there any other way?). I read mrjob tutorial on this site but all examples ignore the key. For example:
class MRWordFrequencyCount(MRJob):
def mapper(self, _, line):
yield "chars", len(line)
yield "words", len(line.split())
yield "lines", 1
def reducer(self, key, values):
yield key, sum(values)
Basically, I'd like something like:
def mapper(self, (constant1,constant2,constant3,constant4,constant5), line):
My calculation goes here
Please suggest me how to do it. Thank you