MAPREDUCE-5137. AM web UI: clicking on Map Task results in 500 error. Contributed by Thomas Graves

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1466952 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason Darrell Lowe 2013-04-11 16:29:34 +00:00
parent 5b63830211
commit 9f3feed745
3 changed files with 19 additions and 3 deletions

View File

@ -125,6 +125,9 @@ Release 2.0.5-beta - UNRELEASED
MAPREDUCE-5098. Fix findbugs warnings in gridmix. (kkambatl via tucu)
MAPREDUCE-5137. AM web UI: clicking on Map Task results in 500 error
(Thomas Graves via jlowe)
Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES
@ -738,6 +741,9 @@ Release 0.23.7 - UNRELEASED
MAPREDUCE-5007. fix coverage org.apache.hadoop.mapreduce.v2.hs (Aleksey
Gorshkov via tgraves)
MAPREDUCE-5137. AM web UI: clicking on Map Task results in 500 error
(Thomas Graves via jlowe)
Release 0.23.6 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -33,6 +33,9 @@ import org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt;
import org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptInfo;
import org.apache.hadoop.yarn.webapp.SubView;
import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY;
import com.google.inject.Inject;
@ -53,7 +56,7 @@ public class TaskPage extends AppView {
h2($(TITLE));
return;
}
html.
TBODY<TABLE<Hamlet>> tbody = html.
table("#attempts").
thead().
tr().
@ -65,7 +68,8 @@ public class TaskPage extends AppView {
th(".tsh", "Started").
th(".tsh", "Finished").
th(".tsh", "Elapsed").
th(".note", "Note")._()._();
th(".note", "Note")._()._().
tbody();
// Write all the data into a JavaScript array of arrays for JQuery
// DataTables to display
StringBuilder attemptsTableData = new StringBuilder("[\n");
@ -105,6 +109,9 @@ public class TaskPage extends AppView {
attemptsTableData.append("]");
html.script().$type("text/javascript").
_("var attemptsTableData=" + attemptsTableData)._();
tbody._()._();
}
protected boolean isValidRequest() {

View File

@ -144,7 +144,10 @@ public class TestAMWebApp {
@Test public void testTaskView() {
AppContext appContext = new TestAppContext();
Map<String, String> params = getTaskParams(appContext);
WebAppTests.testPage(TaskPage.class, AppContext.class, appContext, params);
App app = new App(appContext);
app.setJob(appContext.getAllJobs().values().iterator().next());
app.setTask(app.getJob().getTasks().values().iterator().next());
WebAppTests.testPage(TaskPage.class, App.class, app, params);
}
public static Map<String, String> getJobParams(AppContext appContext) {