diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index ed5bd482b4e..a070488c9e4 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -818,6 +818,9 @@ Release 0.23.3 - UNRELEASED MAPREDUCE-4053. Counters group names deprecation is wrong, iterating over group names deprecated names don't show up (Robert Evans via tgraves) + 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 diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java index 32240f888f4..48c004b23b7 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java @@ -441,6 +441,7 @@ public class JobHistoryParser { username = jobname = jobConfPath = jobQueueName = ""; tasksMap = new HashMap(); jobACLs = new HashMap(); + priority = JobPriority.NORMAL; } /** Print all the job information */ @@ -454,12 +455,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(); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestJobHistoryParsing.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestJobHistoryParsing.java index f2eaeebe97d..b596a2123a7 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestJobHistoryParsing.java +++ b/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()");