You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sn...@apache.org on 2019/08/12 13:06:31 UTC

[hadoop] branch branch-3.2 updated: YARN-9451. AggregatedLogsBlock shows wrong NM http port. Contributed by Prabhu Joseph

This is an automated email from the ASF dual-hosted git repository.

snemeth pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new 8442592  YARN-9451. AggregatedLogsBlock shows wrong NM http port. Contributed by Prabhu Joseph
8442592 is described below

commit 844259203f5bf630cb48b190f86dcac4beba0903
Author: Szilard Nemeth <sn...@apache.org>
AuthorDate: Mon Aug 12 15:05:28 2019 +0200

    YARN-9451. AggregatedLogsBlock shows wrong NM http port. Contributed by Prabhu Joseph
    
    (cherry picked from commit b91099efd6e1fdcb31ec4ca7142439443c9ae536)
---
 .../apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java | 14 ++++++++++++--
 .../yarn/logaggregation/TestAggregatedLogsBlock.java       |  6 +++++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java
index ef6876a..ef5c324 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlock.java
@@ -32,6 +32,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.logaggregation.LogAggregationWebUtils;
 import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileController;
 import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerFactory;
+import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
 import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 import com.google.inject.Inject;
 
@@ -104,8 +105,9 @@ public class AggregatedLogsBlock extends HtmlBlock {
     } catch (Exception fnf) {
       html.h1()
           .__("Logs not available for " + logEntity
-              + ". Aggregation may not be complete, "
-              + "Check back later or try the nodemanager at " + nodeId).__();
+              + ". Aggregation may not be complete, Check back later or "
+              + "try to find the container logs in the local directory of "
+              + "nodemanager " + nodeId).__();
       if(nmApplicationLogUrl != null)  {
         html.h1()
             .__("Or see application log at " + nmApplicationLogUrl)
@@ -129,6 +131,14 @@ public class AggregatedLogsBlock extends HtmlBlock {
     StringBuilder sb = new StringBuilder();
     String scheme = YarnConfiguration.useHttps(this.conf) ? "https://":
         "http://";
+
+    String webAppURLWithoutScheme =
+        WebAppUtils.getNMWebAppURLWithoutScheme(conf);
+    if (webAppURLWithoutScheme.contains(":")) {
+      String httpPort = webAppURLWithoutScheme.split(":")[1];
+      nodeId = NodeId.fromString(nodeId).getHost() + ":" + httpPort;
+    }
+
     sb.append(scheme).append(nodeId).append("/node/application/").append(appId);
     return sb.toString();
   }
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestAggregatedLogsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestAggregatedLogsBlock.java
index 1135f9e..66008a8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestAggregatedLogsBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestAggregatedLogsBlock.java
@@ -145,7 +145,11 @@ public class TestAggregatedLogsBlock {
     block.getWriter().flush();
     String out = data.toString();
     assertTrue(out
-        .contains("Logs not available for entity. Aggregation may not be complete, Check back later or try the nodemanager at localhost:1234"));
+        .contains("Logs not available for entity. Aggregation may not be "
+        + "complete, Check back later or try to find the container logs "
+        + "in the local directory of nodemanager localhost:1234"));
+    assertTrue(out
+        .contains("Or see application log at http://localhost:8042"));
 
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org