def test_find_timeout_error_1(self): LOG_LINES = [ 'Task TASKID="task_201010202309_0001_m_000153" TASK_TYPE="MAP" TASK_STATUS="FAILED" FINISH_TIME="1287618918658" ERROR="Task attempt_201010202309_0001_m_000153_3 failed to report status for 602 seconds. Killing!"', 'Task TASKID="task_201010202309_0001_m_000153" TASK_TYPE="MAP" TASK_STATUS="FAILED" FINISH_TIME="1287618918658" ERROR="Task attempt_201010202309_0001_m_000153_3 failed to report status for 602 seconds. Killing!"', 'Task blahblah', 'Bada bing!', ] LOG_LINES_2 = [ 'Not a match', ] self.assertEqual(find_timeout_error(LOG_LINES), 602) self.assertEqual(find_timeout_error(LOG_LINES_2), None)
def test_find_timeout_error_2(self): LOG_LINES = [ 'Job JOBID="job_201105252346_0001" LAUNCH_TIME="1306367213950" TOTAL_MAPS="2" TOTAL_REDUCES="1" ', 'Task TASKID="task_201105252346_0001_m_000000" TASK_TYPE="MAP" START_TIME="1306367217455" SPLITS="/default-rack/localhost" ', 'MapAttempt TASK_TYPE="MAP" TASKID="task_201105252346_0001_m_000000" TASK_ATTEMPT_ID="attempt_201105252346_0001_m_000000_0" START_TIME="1306367223172" HOSTNAME="/default-rack/ip-10-168-73-40.us-west-1.compute.internal" ', 'Task TASKID="task_201105252346_0001_m_000000" TASK_TYPE="MAP" TASK_STATUS="FAILED" FINISH_TIME="1306367233379" ERROR="Task attempt_201105252346_0001_m_000000_3 failed to report status for 0 seconds. Killing!"', ] self.assertEqual(find_timeout_error(LOG_LINES), 0)
def _timeout_error_wrapper(lines): n = find_timeout_error(lines) return ['Task timeout after %d seconds\n' % n] if n else None
def test_find_timeout_error_3(self): LOG_LINES = [ 'MapAttempt TASK_TYPE="MAP" TASKID="task_201107201804_0001_m_000160" TASK_ATTEMPT_ID="attempt_201107201804_0001_m_000160_0" TASK_STATUS="FAILED" FINISH_TIME="1311188233290" HOSTNAME="/default-rack/ip-10-160-243-66.us-west-1.compute.internal" ERROR="Task attempt_201107201804_0001_m_000160_0 failed to report status for 1201 seconds. Killing!" ' ] self.assertEqual(find_timeout_error(LOG_LINES), 1201)
def parse(self, lines): n = find_timeout_error(lines) if n is not None: return ['Timeout after %d seconds\n' % n] else: return None