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
有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top