check the indent before t0 = time.time()
, did you mixed space and tab?
Why does the main statement in a mrjob Python program accept only one line of code?
-
29-06-2022 - |
Question
I want to know how long a mrjob program runs. However, I get an unindent does not match any outer indentation level
error if I put in time.time()
before and after MRWord.run()
, and I couldn't find any documentation about this. What am I missing?
from mrjob.job import MRJob
class MRWord(MRJob):
def mapper(self, _, line):
x = line.split()
yield x[0], 1
def reducer(self, word, counts):
yield word, sum(counts)
if __name__ == '__main__':
t0 = time.time()
MRWord.run()
print time.time() - t0
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow