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
Was it helpful?

Solution

check the indent before t0 = time.time(), did you mixed space and tab?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top