MAPREDUCE-6305. AM/Task log page should be able to link back to the job. (Siqi Li via gera)

This commit is contained in:
Gera Shegalov 2015-06-20 12:38:36 -07:00
parent 63d40d5286
commit 055cd5a9a1
6 changed files with 45 additions and 26 deletions

View File

@ -355,6 +355,9 @@ Release 2.8.0 - UNRELEASED
MAPREDUCE-6316. Task Attempt List entries should link to the task overview.
(Siqi Li via gera)
MAPREDUCE-6305. AM/Task log page should be able to link back to the job.
(Siqi Li via gera)
OPTIMIZATIONS
BUG FIXES

View File

@ -18,9 +18,13 @@
package org.apache.hadoop.mapreduce.v2.hs.webapp;
import static org.apache.hadoop.yarn.webapp.YarnWebParams.ENTITY_STRING;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.JobID;
import org.apache.hadoop.mapreduce.TaskAttemptID;
import org.apache.hadoop.mapreduce.v2.app.webapp.App;
import org.apache.hadoop.mapreduce.v2.app.webapp.AppController;
import org.apache.hadoop.yarn.webapp.View;
@ -32,8 +36,7 @@ import com.google.inject.Inject;
* This class renders the various pages that the History Server WebApp supports
*/
public class HsController extends AppController {
@Inject HsController(App app, Configuration conf, RequestContext ctx) {
super(app, conf, ctx, "History");
}
@ -175,6 +178,27 @@ public class HsController extends AppController {
* Render the logs page.
*/
public void logs() {
String logEntity = $(ENTITY_STRING);
JobID jid = null;
try {
jid = JobID.forName(logEntity);
set(JOB_ID, logEntity);
requireJob();
} catch (Exception e) {
// fall below
}
if (jid == null) {
try {
TaskAttemptID taskAttemptId = TaskAttemptID.forName(logEntity);
set(TASK_ID, taskAttemptId.getTaskID().toString());
set(JOB_ID, taskAttemptId.getJobID().toString());
requireTask();
requireJob();
} catch (Exception e) {
// fall below
}
}
render(HsLogsPage.class);
}

View File

@ -18,7 +18,6 @@
package org.apache.hadoop.mapreduce.v2.hs.webapp;
import static org.apache.hadoop.mapreduce.v2.app.webapp.AMParams.TASK_ID;
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.*;
import org.apache.hadoop.mapreduce.v2.app.webapp.CountersBlock;
@ -35,12 +34,7 @@ public class HsCountersPage extends HsView {
*/
@Override protected void preHead(Page.HTML<_> html) {
commonPreHead(html);
String tid = $(TASK_ID);
String activeNav = "2";
if(tid == null || tid.isEmpty()) {
activeNav = "1";
}
set(initID(ACCORDION, "nav"), "{autoHeight:false, active:"+activeNav+"}");
setActiveNavColumnForTask();
set(DATATABLES_SELECTOR, "#counters .dt-counters");
set(initSelector(DATATABLES),
"{bJQueryUI:true, sDom:'t', iDisplayLength:-1}");

View File

@ -17,9 +17,6 @@
*/
package org.apache.hadoop.mapreduce.v2.hs.webapp;
import static org.apache.hadoop.yarn.webapp.YarnWebParams.CONTAINER_ID;
import static org.apache.hadoop.yarn.webapp.YarnWebParams.ENTITY_STRING;
import org.apache.hadoop.yarn.webapp.SubView;
import org.apache.hadoop.yarn.webapp.log.AggregatedLogsBlock;
@ -30,14 +27,8 @@ public class HsLogsPage extends HsView {
* @see org.apache.hadoop.mapreduce.v2.hs.webapp.HsView#preHead(org.apache.hadoop.yarn.webapp.hamlet.Hamlet.HTML)
*/
@Override protected void preHead(Page.HTML<_> html) {
String logEntity = $(ENTITY_STRING);
if (logEntity == null || logEntity.isEmpty()) {
logEntity = $(CONTAINER_ID);
}
if (logEntity == null || logEntity.isEmpty()) {
logEntity = "UNKNOWN";
}
commonPreHead(html);
setActiveNavColumnForTask();
}
/**

View File

@ -18,7 +18,6 @@
package org.apache.hadoop.mapreduce.v2.hs.webapp;
import static org.apache.hadoop.mapreduce.v2.app.webapp.AMParams.TASK_ID;
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.*;
import org.apache.hadoop.mapreduce.v2.app.webapp.SingleCounterBlock;
@ -35,12 +34,7 @@ public class HsSingleCounterPage extends HsView {
*/
@Override protected void preHead(Page.HTML<_> html) {
commonPreHead(html);
String tid = $(TASK_ID);
String activeNav = "2";
if(tid == null || tid.isEmpty()) {
activeNav = "1";
}
set(initID(ACCORDION, "nav"), "{autoHeight:false, active:"+activeNav+"}");
setActiveNavColumnForTask();
set(DATATABLES_ID, "singleCounter");
set(initID(DATATABLES, "singleCounter"), counterTableInit());
setTableStyles(html, "singleCounter");

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.mapreduce.v2.hs.webapp;
import static org.apache.hadoop.mapreduce.v2.app.webapp.AMParams.TASK_ID;
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION;
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION_ID;
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES;
@ -55,6 +56,18 @@ public class HsView extends TwoColumnLayout {
set(initID(ACCORDION, "nav"), "{autoHeight:false, active:0}");
}
/**
* Determine which navigation column is active.
*/
protected void setActiveNavColumnForTask() {
String tid = $(TASK_ID);
String activeNav = "2";
if((tid == null || tid.isEmpty())) {
activeNav = "1";
}
set(initID(ACCORDION, "nav"), "{autoHeight:false, active:"+activeNav+"}");
}
/*
* (non-Javadoc)
* @see org.apache.hadoop.yarn.webapp.view.TwoColumnLayout#nav()