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; }
status.equals(TaskStatus.State.SUCCEEDED.toString())) { long mapFinishTime = attempt.getMapFinishTime(); assertTrue(startTime < mapFinishTime);
reportedStatus.stateString = taInfo.getState(); reportedStatus.phase = Phase.CLEANUP; reportedStatus.mapFinishTime = taInfo.getMapFinishTime(); reportedStatus.shuffleFinishTime = taInfo.getShuffleFinishTime(); reportedStatus.sortFinishTime = taInfo.getSortFinishTime();
reportedStatus.stateString = taInfo.getState(); reportedStatus.phase = Phase.CLEANUP; reportedStatus.mapFinishTime = taInfo.getMapFinishTime(); reportedStatus.shuffleFinishTime = taInfo.getShuffleFinishTime(); reportedStatus.sortFinishTime = taInfo.getSortFinishTime();
reportedStatus.stateString = taInfo.getState(); reportedStatus.phase = Phase.CLEANUP; reportedStatus.mapFinishTime = taInfo.getMapFinishTime(); reportedStatus.shuffleFinishTime = taInfo.getShuffleFinishTime(); reportedStatus.sortFinishTime = taInfo.getSortFinishTime();