diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 45231463c53..aea746554fc 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -91,6 +91,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 diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsController.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsController.java index b7bdfa4e8f4..2cc7ad568e1 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsController.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsController.java @@ -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); } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsCountersPage.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsCountersPage.java index 1bae8fd8af8..e70a668be0d 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsCountersPage.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsCountersPage.java @@ -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}"); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsLogsPage.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsLogsPage.java index 909a316dbfe..f483dc96b04 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsLogsPage.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsLogsPage.java @@ -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(); } /** diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsSingleCounterPage.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsSingleCounterPage.java index 4e0036a650a..5f97b8fdb20 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsSingleCounterPage.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsSingleCounterPage.java @@ -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"); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java index 229bbb0bc8a..8e390872c13 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java @@ -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()