Browse Source

svn merge -c 1375602 FIXES: MAPREDUCE-3506. Calling getPriority on JobInfo after parsing a history log with JobHistoryParser throws a NullPointerException (Jason Lowe via bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1375606 13f79535-47bb-0310-9956-ffa450edef68
Robert Joseph Evans 12 years ago
parent
commit
6da5fbac0e

+ 3 - 0
hadoop-mapreduce-project/CHANGES.txt

@@ -406,6 +406,9 @@ Release 0.23.3 - UNRELEASED
     MAPREDUCE-4097. tools testcases fail because missing mrapp-generated-classpath 
     file in classpath (rvs via tucu)
  
+    MAPREDUCE-3506. Calling getPriority on JobInfo after parsing a history log
+    with JobHistoryParser throws a NullPointerException (Jason Lowe via bobby)
+
 Release 0.23.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 14 - 5
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java

@@ -438,6 +438,7 @@ public class JobHistoryParser {
       username = jobname = jobConfPath = jobQueueName = "";
       tasksMap = new HashMap<TaskID, TaskInfo>();
       jobACLs = new HashMap<JobACL, AccessControlList>();
+      priority = JobPriority.NORMAL;
     }
     
     /** Print all the job information */
@@ -451,12 +452,20 @@ public class JobHistoryParser {
       System.out.println("PRIORITY: " + priority);
       System.out.println("TOTAL_MAPS: " + totalMaps);
       System.out.println("TOTAL_REDUCES: " + totalReduces);
-      System.out.println("MAP_COUNTERS:" + mapCounters.toString());
-      System.out.println("REDUCE_COUNTERS:" + reduceCounters.toString());
-      System.out.println("TOTAL_COUNTERS: " + totalCounters.toString());
+      if (mapCounters != null) {
+        System.out.println("MAP_COUNTERS:" + mapCounters.toString());
+      }
+      if (reduceCounters != null) {
+        System.out.println("REDUCE_COUNTERS:" + reduceCounters.toString());
+      }
+      if (totalCounters != null) {
+        System.out.println("TOTAL_COUNTERS: " + totalCounters.toString());
+      }
       System.out.println("UBERIZED: " + uberized);
-      for (AMInfo amInfo : amInfos) {
-        amInfo.printAll();
+      if (amInfos != null) {
+        for (AMInfo amInfo : amInfos) {
+          amInfo.printAll();
+        }
       }
       for (TaskInfo ti: tasksMap.values()) {
         ti.printAll();

+ 7 - 0
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestJobHistoryParsing.java

@@ -83,6 +83,13 @@ public class TestJobHistoryParsing {
     }
   }
 
+  @Test
+  public void testJobInfo() throws Exception {
+    JobInfo info = new JobInfo();
+    Assert.assertEquals("NORMAL", info.getPriority());
+    info.printAll();
+  }
+
   @Test
   public void testHistoryParsing() throws Exception {
     LOG.info("STARTING testHistoryParsing()");