// List<TaskAttemptInfo> successfulReduceAttemptList =
// new ArrayList<TaskAttemptInfo>();
for (JobHistoryParser.TaskInfo taskInfo: taskMap.values()) {
if (taskInfo.getTaskType().equals(TaskType.MAP)) {
MapTaskStatistics mapT = new MapTaskStatistics();
TaskAttemptInfo successfulAttempt =
getLastSuccessfulTaskAttempt(taskInfo);
mapT.setValue(MapTaskKeys.TASK_ID,
successfulAttempt.getAttemptId().getTaskID().toString());
mapT.setValue(MapTaskKeys.ATTEMPT_ID,
successfulAttempt.getAttemptId().toString());
mapT.setValue(MapTaskKeys.HOSTNAME,
successfulAttempt.getTrackerName());
mapT.setValue(MapTaskKeys.TASK_TYPE,
successfulAttempt.getTaskType().toString());
mapT.setValue(MapTaskKeys.STATUS,
successfulAttempt.getTaskStatus().toString());
mapT.setValue(MapTaskKeys.START_TIME, successfulAttempt.getStartTime());
mapT.setValue(MapTaskKeys.FINISH_TIME, successfulAttempt.getFinishTime());
mapT.setValue(MapTaskKeys.SPLITS, taskInfo.getSplitLocations());
mapT.setValue(MapTaskKeys.TRACKER_NAME, successfulAttempt.getTrackerName());
mapT.setValue(MapTaskKeys.STATE_STRING, successfulAttempt.getState());
mapT.setValue(MapTaskKeys.HTTP_PORT, successfulAttempt.getHttpPort());
mapT.setValue(MapTaskKeys.ERROR, successfulAttempt.getError());
parseAndAddMapTaskCounters(mapT,
successfulAttempt.getCounters().toString());
mapTaskList.add(mapT);
// Add number of task attempts
mapT.setValue(MapTaskKeys.NUM_ATTEMPTS,
(new Integer(taskInfo.getAllTaskAttempts().size())).toString());
// Add EXECUTION_TIME = FINISH_TIME - START_TIME
long etime = mapT.getLongValue(MapTaskKeys.FINISH_TIME) -
mapT.getLongValue(MapTaskKeys.START_TIME);
mapT.setValue(MapTaskKeys.EXECUTION_TIME, (new Long(etime)).toString());
}else if (taskInfo.getTaskType().equals(TaskType.REDUCE)) {
ReduceTaskStatistics reduceT = new ReduceTaskStatistics();
TaskAttemptInfo successfulAttempt =
getLastSuccessfulTaskAttempt(taskInfo);
reduceT.setValue(ReduceTaskKeys.TASK_ID,
successfulAttempt.getAttemptId().getTaskID().toString());
reduceT.setValue(ReduceTaskKeys.ATTEMPT_ID,
successfulAttempt.getAttemptId().toString());
reduceT.setValue(ReduceTaskKeys.HOSTNAME,
successfulAttempt.getTrackerName());
reduceT.setValue(ReduceTaskKeys.TASK_TYPE,
successfulAttempt.getTaskType().toString());
reduceT.setValue(ReduceTaskKeys.STATUS,
successfulAttempt.getTaskStatus().toString());
reduceT.setValue(ReduceTaskKeys.START_TIME,
successfulAttempt.getStartTime());
reduceT.setValue(ReduceTaskKeys.FINISH_TIME,
successfulAttempt.getFinishTime());
reduceT.setValue(ReduceTaskKeys.SHUFFLE_FINISH_TIME,
successfulAttempt.getShuffleFinishTime());
reduceT.setValue(ReduceTaskKeys.SORT_FINISH_TIME,
successfulAttempt.getSortFinishTime());
reduceT.setValue(ReduceTaskKeys.SPLITS, "");
reduceT.setValue(ReduceTaskKeys.TRACKER_NAME,
successfulAttempt.getTrackerName());
reduceT.setValue(ReduceTaskKeys.STATE_STRING,
successfulAttempt.getState());
reduceT.setValue(ReduceTaskKeys.HTTP_PORT,
successfulAttempt.getHttpPort());
parseAndAddReduceTaskCounters(reduceT,
successfulAttempt.getCounters().toString());
reduceTaskList.add(reduceT);
// Add number of task attempts
reduceT.setValue(ReduceTaskKeys.NUM_ATTEMPTS,