문제

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