|
@@ -3,6 +3,7 @@ package org.apache.hadoop.mapred;
|
|
|
import java.util.*;
|
|
|
import java.io.*;
|
|
|
import org.apache.hadoop.mapred.JobHistory.Keys ;
|
|
|
+import org.apache.hadoop.mapred.JobHistory.Values; ;
|
|
|
|
|
|
/**
|
|
|
* Default parser for job history files. It creates object model from
|
|
@@ -153,4 +154,33 @@ public class DefaultJobHistoryParser {
|
|
|
return jobTrackerToJobs;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ // call this only for jobs that succeeded for better results.
|
|
|
+ static class BadNodesFilter implements JobHistory.Listener {
|
|
|
+ private Map<String, Set<String>> badNodesToNumFaiedTasks = new HashMap();
|
|
|
+ Map<String, Set<String>> getValues(){
|
|
|
+ return badNodesToNumFaiedTasks;
|
|
|
+ }
|
|
|
+ public void handle(JobHistory.RecordTypes recType, Map<Keys, String> values)
|
|
|
+ throws IOException {
|
|
|
+
|
|
|
+ if (recType.equals(JobHistory.RecordTypes.MapAttempt) ||
|
|
|
+ recType.equals(JobHistory.RecordTypes.ReduceAttempt) ) {
|
|
|
+
|
|
|
+ if( Values.FAILED.name().equals(values.get(Keys.TASK_STATUS) ) ){
|
|
|
+ String hostName = values.get(Keys.HOSTNAME) ;
|
|
|
+ String taskid = values.get(Keys.TASKID);
|
|
|
+ Set tasks = badNodesToNumFaiedTasks.get(hostName);
|
|
|
+ if( null == tasks ){
|
|
|
+ tasks = new TreeSet();
|
|
|
+ tasks.add(taskid);
|
|
|
+ badNodesToNumFaiedTasks.put(hostName, tasks);
|
|
|
+ }else{
|
|
|
+ tasks.add(taskid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|