hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jia...@apache.org
Subject hadoop git commit: YARN-6627. Use deployed webapp folder to launch new YARN UI. Contributed by Sunil G
Date Sat, 20 May 2017 03:12:15 GMT
Repository: hadoop
Updated Branches:
  refs/heads/yarn-native-services 08c756ea9 -> 8c3b3db41


YARN-6627. Use deployed webapp folder to launch new YARN UI. Contributed by Sunil G


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

Branch: refs/heads/yarn-native-services
Commit: 8c3b3db4130c8b5b774a7b81a0ca062a5a70c25b
Parents: 08c756e
Author: Jian He <jianhe@apache.org>
Authored: Fri May 19 20:12:06 2017 -0700
Committer: Jian He <jianhe@apache.org>
Committed: Fri May 19 20:12:06 2017 -0700

----------------------------------------------------------------------
 .../resources/assemblies/hadoop-yarn-dist.xml   |  5 ++-
 .../server/resourcemanager/ResourceManager.java | 34 ++++++++++++++------
 2 files changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c3b3db4/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
----------------------------------------------------------------------
diff --git a/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml b/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
index 391a7f5..5450764 100644
--- a/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
+++ b/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
@@ -206,7 +206,7 @@
     </fileSet>
       <fileSet>
       <directory>hadoop-yarn/hadoop-yarn-ui/target/hadoop-yarn-ui-${project.version}</directory>
-      <outputDirectory>/share/hadoop/${hadoop.component}/webapps/rm</outputDirectory>
+      <outputDirectory>/share/hadoop/${hadoop.component}/webapps/ui2</outputDirectory>
       <includes>
         <include>**/*</include>
       </includes>
@@ -214,6 +214,9 @@
   </fileSets>
   <moduleSets>
     <moduleSet>
+      <excludes>
+        <exclude>org.apache.hadoop:hadoop-yarn-ui</exclude>
+      </excludes>
       <binaries>
         <outputDirectory>share/hadoop/${hadoop.component}</outputDirectory>
         <includeDependencies>false</includeDependencies>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c3b3db4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
index 81c3f1b..f42166d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
@@ -118,6 +118,8 @@ import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
 import org.eclipse.jetty.webapp.WebAppContext;
 
 import com.google.common.annotations.VisibleForTesting;
+
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
@@ -1125,33 +1127,47 @@ public class ResourceManager extends CompositeService implements Recoverable
{
     WebAppContext uiWebAppContext = null;
     if (getConfig().getBoolean(YarnConfiguration.YARN_WEBAPP_UI2_ENABLE,
         YarnConfiguration.DEFAULT_YARN_WEBAPP_UI2_ENABLE)) {
-      String webPath = UI2_WEBAPP_NAME;
       String onDiskPath = getConfig()
           .get(YarnConfiguration.YARN_WEBAPP_UI2_WARFILE_PATH);
 
+      uiWebAppContext = new WebAppContext();
+      uiWebAppContext.setContextPath(UI2_WEBAPP_NAME);
+
       if (null == onDiskPath) {
         String war = "hadoop-yarn-ui-" + VersionInfo.getVersion() + ".war";
         URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader();
         URL url = cl.findResource(war);
 
         if (null == url) {
-          onDiskPath = "";
+          onDiskPath = getWebAppsPath("ui2");
         } else {
           onDiskPath = url.getFile();
         }
-
-        LOG.info(
-            "New web UI war file name:" + war + ", and path:" + onDiskPath);
       }
-
-      uiWebAppContext = new WebAppContext();
-      uiWebAppContext.setContextPath(webPath);
-      uiWebAppContext.setWar(onDiskPath);
+      if (onDiskPath == null || onDiskPath.isEmpty()) {
+          LOG.error("No war file or webapps found for ui2 !");
+      } else {
+        if (onDiskPath.endsWith(".war")) {
+          uiWebAppContext.setWar(onDiskPath);
+          LOG.info("Using war file at: " + onDiskPath);
+        } else {
+          uiWebAppContext.setResourceBase(onDiskPath);
+          LOG.info("Using webapps at: " + onDiskPath);
+        }
+      }
     }
 
     webApp = builder.start(new RMWebApp(this), uiWebAppContext);
   }
 
+  private String getWebAppsPath(String appName) {
+    URL url = getClass().getClassLoader().getResource("webapps/" + appName);
+    if (url == null) {
+      return "";
+    }
+    return url.toString();
+  }
+
   /**
    * Helper method to create and init {@link #activeServices}. This creates an
    * instance of {@link RMActiveServices} and initializes it.


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


Mime
View raw message