hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject [02/50] [abbrv] hadoop git commit: MAPREDUCE-6305. AM/Task log page should be able to link back to the job. (Siqi Li via gera)
Date Mon, 29 Jun 2015 23:30:18 GMT
MAPREDUCE-6305. AM/Task log page should be able to link back to the job. (Siqi Li via gera)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8a918b66
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8a918b66
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8a918b66

Branch: refs/heads/YARN-2928
Commit: 8a918b66b48ff8e3d19e8144e5d14bef3da108f4
Parents: 732a1e9
Author: Gera Shegalov <gera@apache.org>
Authored: Sat Jun 20 12:38:36 2015 -0700
Committer: Zhijie Shen <zjshen@apache.org>
Committed: Mon Jun 29 10:28:20 2015 -0700

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt            |  3 +++
 .../mapreduce/v2/hs/webapp/HsController.java    | 28 ++++++++++++++++++--
 .../mapreduce/v2/hs/webapp/HsCountersPage.java  |  8 +-----
 .../mapreduce/v2/hs/webapp/HsLogsPage.java      | 11 +-------
 .../v2/hs/webapp/HsSingleCounterPage.java       |  8 +-----
 .../hadoop/mapreduce/v2/hs/webapp/HsView.java   | 13 +++++++++
 6 files changed, 45 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a918b66/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index 5ee325c..b23bfe9 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -379,6 +379,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

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a918b66/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsController.java
----------------------------------------------------------------------
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 b7bdfa4..2cc7ad5 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);
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a918b66/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsCountersPage.java
----------------------------------------------------------------------
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 1bae8fd..e70a668 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}");

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a918b66/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsLogsPage.java
----------------------------------------------------------------------
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 909a316..f483dc9 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();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a918b66/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsSingleCounterPage.java
----------------------------------------------------------------------
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 4e0036a..5f97b8f 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");

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a918b66/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java
----------------------------------------------------------------------
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 229bbb0..8e39087 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()


Mime
View raw message