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
This commit is contained in:
Arun Murthy 2011-10-28 05:08:04 +00:00
parent 9b34900c89
commit 34e6de8f85
3 changed files with 23 additions and 7 deletions

View File

@ -1824,11 +1824,15 @@ Release 0.23.0 - Unreleased
MAPREDUCE-3282. bin/mapred job -list throws exception. (acmurthy via MAPREDUCE-3282. bin/mapred job -list throws exception. (acmurthy via
mahadev) mahadev)
MAPREDUCE-3186. User jobs are getting hanged if the Resource manager process goes down MAPREDUCE-3186. User jobs are getting hanged if the Resource manager
and comes up while job is getting executed. (Eric Payne via mahadev) process goes down and comes up while job is getting executed.
(Eric Payne via mahadev)
MAPREDUCE-3209. Jenkins reports 160 FindBugs warnings (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 Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -119,11 +119,16 @@ public class CountersBlock extends HtmlBlock {
for (Counter counter : g.getAllCounters().values()) { for (Counter counter : g.getAllCounters().values()) {
// Ditto // Ditto
TR<TBODY<TABLE<TD<TR<TBODY<TABLE<DIV<Hamlet>>>>>>>> groupRow = group. TR<TBODY<TABLE<TD<TR<TBODY<TABLE<DIV<Hamlet>>>>>>>> groupRow = group.
tr(). tr();
td().$title(counter.getName()). if (mg == null && rg == null) {
groupRow.td().$title(counter.getName())._(counter.getDisplayName()).
_();
} else {
groupRow.td().$title(counter.getName()).
a(url(urlBase,urlId,g.getName(), a(url(urlBase,urlId,g.getName(),
counter.getName()), counter.getDisplayName()). counter.getName()), counter.getDisplayName()).
_(); _();
}
if (map != null) { if (map != null) {
Counter mc = mg == null ? null : mg.getCounter(counter.getName()); Counter mc = mg == null ? null : mg.getCounter(counter.getName());
Counter rc = rg == null ? null : rg.getCounter(counter.getName()); Counter rc = rg == null ? null : rg.getCounter(counter.getName());
@ -168,12 +173,11 @@ public class CountersBlock extends HtmlBlock {
} }
// Get all types of counters // Get all types of counters
Map<TaskId, Task> tasks = job.getTasks(); Map<TaskId, Task> tasks = job.getTasks();
total = JobImpl.newCounters(); total = job.getCounters();
map = JobImpl.newCounters(); map = JobImpl.newCounters();
reduce = JobImpl.newCounters(); reduce = JobImpl.newCounters();
for (Task t : tasks.values()) { for (Task t : tasks.values()) {
Counters counters = t.getCounters(); Counters counters = t.getCounters();
JobImpl.incrAllCounters(total, counters);
switch (t.getType()) { switch (t.getType()) {
case MAP: JobImpl.incrAllCounters(map, counters); break; case MAP: JobImpl.incrAllCounters(map, counters); break;
case REDUCE: JobImpl.incrAllCounters(reduce, counters); break; case REDUCE: JobImpl.incrAllCounters(reduce, counters); break;
@ -184,4 +188,4 @@ public class CountersBlock extends HtmlBlock {
private String fixGroupDisplayName(CharSequence name) { private String fixGroupDisplayName(CharSequence name) {
return name.toString().replace(".", ".\u200B").replace("$", "\u200B$"); return name.toString().replace(".", ".\u200B").replace("$", "\u200B$");
} }
} }

View File

@ -175,6 +175,14 @@ public class TestHSWebApp {
new TestAppContext()); new TestAppContext());
} }
@Test public void testJobCounterView() {
LOG.info("JobCounterView");
AppContext appContext = new TestAppContext();
Map<String, String> params = TestAMWebApp.getJobParams(appContext);
WebAppTests.testPage(HsCountersPage.class, AppContext.class,
appContext, params);
}
@Test public void testSingleCounterView() { @Test public void testSingleCounterView() {
LOG.info("HsSingleCounterPage"); LOG.info("HsSingleCounterPage");
WebAppTests.testPage(HsSingleCounterPage.class, AppContext.class, WebAppTests.testPage(HsSingleCounterPage.class, AppContext.class,