private TaskAttemptInfo getMockTaskAttemptInfo(TaskAttemptID tai, TaskAttemptState tas) { ContainerId ci = mock(ContainerId.class); Counters counters = mock(Counters.class); TaskType tt = TaskType.MAP; long finishTime = System.currentTimeMillis(); TaskAttemptInfo mockTAinfo = mock(TaskAttemptInfo.class); when(mockTAinfo.getAttemptId()).thenReturn(tai); when(mockTAinfo.getContainerId()).thenReturn(ci); when(mockTAinfo.getCounters()).thenReturn(counters); when(mockTAinfo.getError()).thenReturn(""); when(mockTAinfo.getFinishTime()).thenReturn(finishTime); when(mockTAinfo.getHostname()).thenReturn("localhost"); when(mockTAinfo.getHttpPort()).thenReturn(23); when(mockTAinfo.getMapFinishTime()).thenReturn(finishTime - 1000L); when(mockTAinfo.getPort()).thenReturn(24); when(mockTAinfo.getRackname()).thenReturn("defaultRack"); when(mockTAinfo.getShuffleFinishTime()).thenReturn(finishTime - 2000L); when(mockTAinfo.getShufflePort()).thenReturn(25); when(mockTAinfo.getSortFinishTime()).thenReturn(finishTime - 3000L); when(mockTAinfo.getStartTime()).thenReturn(finishTime -10000); when(mockTAinfo.getState()).thenReturn("task in progress"); when(mockTAinfo.getTaskStatus()).thenReturn(tas.toString()); when(mockTAinfo.getTaskType()).thenReturn(tt); when(mockTAinfo.getTrackerName()).thenReturn("TrackerName"); return mockTAinfo; }
Counters counters = attempt.getCounters(); assertNotNull(counters);
JobHistoryParser.TaskAttemptInfo attempt = attempts.get(TaskAttemptID.forName(attemptid)); Counters counters = attempt.getCounters();
reportedStatus.counters = taInfo.getCounters(); reportedStatus.stateString = taInfo.getState(); reportedStatus.phase = Phase.CLEANUP;
reportedStatus.counters = taInfo.getCounters(); reportedStatus.stateString = taInfo.getState(); reportedStatus.phase = Phase.CLEANUP;
assertTrue("Counters of Task Attempt " + attemptId + " obtained from " + "history file did not match the expected value", c.equals(attempt.getCounters()));
reportedStatus.counters = taInfo.getCounters(); reportedStatus.stateString = taInfo.getState(); reportedStatus.phase = Phase.CLEANUP;
Counters counters = taskAttempt.getCounters(); if (counters != null) { TaskAttemptID attemptId = taskAttempt.getAttemptId();
@Override public Counters getCounters() { return attemptInfo.getCounters(); }
@Override public Counters getCounters() { return attemptInfo.getCounters(); }
@Override public Counters getCounters() { return attemptInfo.getCounters(); }