From 34e6de8f856648b4d74997410d9cc8da4010d7c9 Mon Sep 17 00:00:00 2001 From: Arun Murthy Date: Fri, 28 Oct 2011 05:08:04 +0000 Subject: [PATCH] MAPREDUCE-3258. Fixed AM & JobHistory web-ui to display counters properly. Contributed by Siddharth Seth. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1190160 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 8 ++++++-- .../mapreduce/v2/app/webapp/CountersBlock.java | 14 +++++++++----- .../mapreduce/v2/hs/webapp/TestHSWebApp.java | 8 ++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 32b3d099ad..f6b13cd7ad 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -1824,11 +1824,15 @@ Release 0.23.0 - Unreleased MAPREDUCE-3282. bin/mapred job -list throws exception. (acmurthy via mahadev) - MAPREDUCE-3186. User jobs are getting hanged if the Resource manager process goes down - and comes up while job is getting executed. (Eric Payne via mahadev) + MAPREDUCE-3186. User jobs are getting hanged if the Resource manager + process goes down and comes up while job is getting executed. + (Eric Payne via mahadev) MAPREDUCE-3209. Jenkins reports 160 FindBugs warnings (mahadev) + MAPREDUCE-3258. Fixed AM & JobHistory web-ui to display counters properly. + (Siddharth Seth via acmurthy) + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/CountersBlock.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/CountersBlock.java index a23821ec4b..cf6ab99a93 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/CountersBlock.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/CountersBlock.java @@ -119,11 +119,16 @@ public class CountersBlock extends HtmlBlock { for (Counter counter : g.getAllCounters().values()) { // Ditto TR>>>>>>> groupRow = group. - tr(). - td().$title(counter.getName()). + tr(); + if (mg == null && rg == null) { + groupRow.td().$title(counter.getName())._(counter.getDisplayName()). + _(); + } else { + groupRow.td().$title(counter.getName()). a(url(urlBase,urlId,g.getName(), counter.getName()), counter.getDisplayName()). _(); + } if (map != null) { Counter mc = mg == null ? null : mg.getCounter(counter.getName()); Counter rc = rg == null ? null : rg.getCounter(counter.getName()); @@ -168,12 +173,11 @@ private void getCounters(AppContext ctx) { } // Get all types of counters Map tasks = job.getTasks(); - total = JobImpl.newCounters(); + total = job.getCounters(); map = JobImpl.newCounters(); reduce = JobImpl.newCounters(); for (Task t : tasks.values()) { Counters counters = t.getCounters(); - JobImpl.incrAllCounters(total, counters); switch (t.getType()) { case MAP: JobImpl.incrAllCounters(map, counters); break; case REDUCE: JobImpl.incrAllCounters(reduce, counters); break; @@ -184,4 +188,4 @@ private void getCounters(AppContext ctx) { private String fixGroupDisplayName(CharSequence name) { return name.toString().replace(".", ".\u200B").replace("$", "\u200B$"); } -} +} \ No newline at end of file diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestHSWebApp.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestHSWebApp.java index c0b944fab5..a318f345cf 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestHSWebApp.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestHSWebApp.java @@ -175,6 +175,14 @@ public void testTaskView() { new TestAppContext()); } + @Test public void testJobCounterView() { + LOG.info("JobCounterView"); + AppContext appContext = new TestAppContext(); + Map params = TestAMWebApp.getJobParams(appContext); + WebAppTests.testPage(HsCountersPage.class, AppContext.class, + appContext, params); + } + @Test public void testSingleCounterView() { LOG.info("HsSingleCounterPage"); WebAppTests.testPage(HsSingleCounterPage.class, AppContext.class,