case FINISH_TIME:
endTime = Long.valueOf(val);
break;
case COUNTERS: {
try {
Counters counters = Counters.fromEscapedCompactString(val);
long rows = counters.getGroup(TASK_COUNTER_GROUP)
.getCounterForName(MAP_INPUT_RECORDS).getCounter();
if (rows < minMapRows) minMapRows = rows;
if (rows > maxMapRows) maxMapRows = rows;
} catch (ParseException e) {
LOG.warn("Failed to parse job counters", e);
}
}
break;
default:
LOG.warn("JobHistory.Keys." + key
+ " : NOT INCLUDED IN PERFORMANCE ADVISOR MAP COUNTERS");
break;
}
}
duration = endTime - startTime;
if (minMapTime > duration) minMapTime = duration;
if (maxMapTime < duration) maxMapTime = duration;
totalMapTime += duration;
} else if (task.get(Keys.TASK_TYPE).equals("REDUCE")) {
Map<JobHistory.Keys, String> reduceTask = task.getValues();
Map<JobHistory.Keys, String> successTaskAttemptMap = getLastSuccessfulTaskAttempt(task);
// NOTE: Following would lead to less number of actual tasks collected in the tasklist array
if (successTaskAttemptMap != null) {
reduceTask.putAll(successTaskAttemptMap);
} else {
LOG.warn("Task:<" + task.get(Keys.TASKID) + "> is not successful - SKIPPING");
}
long duration = 0;
long startTime = 0;
long endTime = 0;
int size = reduceTask.size();
numberReduces++;
Iterator<Map.Entry<JobHistory.Keys, String>> kv = reduceTask.entrySet().iterator();
for (int j = 0; j < size; j++) {
Map.Entry<JobHistory.Keys, String> rtc = kv.next();
JobHistory.Keys key = rtc.getKey();
String val = rtc.getValue();
switch (key) {
case START_TIME:
startTime = Long.valueOf(val);
break;
case FINISH_TIME:
endTime = Long.valueOf(val);
break;
case COUNTERS: {
try {
Counters counters = Counters.fromEscapedCompactString(val);
long rows = counters.getGroup(TASK_COUNTER_GROUP)
.getCounterForName(REDUCE_INPUT_RECORDS).getCounter();
if (rows < minReduceRows) minReduceRows = rows;
if (rows > maxReduceRows) maxReduceRows = rows;
} catch (ParseException e) {
LOG.warn("Failed to parse job counters", e);