hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1577409 - in /hadoop/common/branches/branch-2/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/ hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/ hadoop-yarn/hadoo...
Date Fri, 14 Mar 2014 02:40:29 GMT
Author: vinodkv
Date: Fri Mar 14 02:40:28 2014
New Revision: 1577409

URL: http://svn.apache.org/r1577409
Log:
YARN-1658. Modified web-app framework to let standby RMs redirect web-service calls to the
active RM. Contributed by Cindy Li.
svn merge --ignore-ancestry -c 1577408 ../../trunk/

Added:
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebAppFilter.java
      - copied unchanged from r1577408, hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebAppFilter.java
Removed:
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMDispatcher.java
Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Dispatcher.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApp.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1577409&r1=1577408&r2=1577409&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Fri Mar 14 02:40:28 2014
@@ -276,6 +276,9 @@ Release 2.4.0 - UNRELEASED
     YARN-1771. Reduce the number of NameNode operations during localization of
     public resources using a cache. (Sangjin Lee via cdouglas)
 
+    YARN-1658. Modified web-app framework to let standby RMs redirect
+    web-service calls to the active RM. (Cindy Li via vinodkv)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java?rev=1577409&r1=1577408&r2=1577409&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java
Fri Mar 14 02:40:28 2014
@@ -271,6 +271,12 @@ public class TestRMFailover extends Clie
     header = getHeader("Refresh", rm2Url + "/cluster/cluster");
     assertEquals(null, header);
 
+    header = getHeader("Refresh", rm2Url + "/ws/v1/cluster/info");
+    assertEquals(null, header);
+
+    header = getHeader("Refresh", rm2Url + "/ws/v1/cluster/apps");
+    assertTrue(header.contains("; url=" + rm1Url));
+
     // Due to the limitation of MiniYARNCluster and dispatcher is a singleton,
     // we couldn't add the test case after explicitFailover();
   }
@@ -286,4 +292,5 @@ public class TestRMFailover extends Clie
     }
     return fieldHeader;
   }
+
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Dispatcher.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Dispatcher.java?rev=1577409&r1=1577408&r2=1577409&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Dispatcher.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Dispatcher.java
Fri Mar 14 02:40:28 2014
@@ -57,11 +57,11 @@ public class Dispatcher extends HttpServ
 
   private transient final Injector injector;
   private transient final Router router;
-  protected transient final WebApp webApp;
+  private transient final WebApp webApp;
   private volatile boolean devMode = false;
 
   @Inject
-  protected Dispatcher(WebApp webApp, Injector injector, Router router) {
+  Dispatcher(WebApp webApp, Injector injector, Router router) {
     this.webApp = webApp;
     this.injector = injector;
     this.router = router;

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java?rev=1577409&r1=1577408&r2=1577409&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java
Fri Mar 14 02:40:28 2014
@@ -44,7 +44,7 @@ import com.google.common.collect.Maps;
  * Manages path info to controller#action routing.
  */
 @InterfaceAudience.LimitedPrivate({"YARN", "MapReduce"})
-public class Router {
+class Router {
   static final Logger LOG = LoggerFactory.getLogger(Router.class);
   static final ImmutableList<String> EMPTY_LIST = ImmutableList.of();
   static final CharMatcher SLASH = CharMatcher.is('/');

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApp.java?rev=1577409&r1=1577408&r2=1577409&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApp.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApp.java
Fri Mar 14 02:40:28 2014
@@ -122,6 +122,10 @@ public abstract class WebApp extends Ser
 
   public String name() { return this.name; }
 
+  public String wsName() {
+    return this.wsName;
+  }
+
   void addServePathSpec(String path) { this.servePathSpecs.add(path); }
 
   public String[] getServePathSpecs() {
@@ -134,7 +138,7 @@ public abstract class WebApp extends Ser
    * more easily differentiate the different webapps.
    * @param path  the path to redirect to
    */
-  protected void setRedirectPath(String path) {
+  void setRedirectPath(String path) {
     this.redirectPath = path;
   }
 
@@ -160,10 +164,10 @@ public abstract class WebApp extends Ser
       serve(path).with(Dispatcher.class);
     }
 
-    configureRSServlets();
+    configureWebAppServlets();
   }
 
-  protected void configureRSServlets() {
+  protected void configureWebAppServlets() {
     // Add in the web services filters/serves if app has them.
     // Using Jersey/guice integration module. If user has web services
     // they must have also bound a default one in their webapp code.
@@ -182,9 +186,12 @@ public abstract class WebApp extends Ser
       params.put(FeaturesAndProperties.FEATURE_XMLROOTELEMENT_PROCESSING, "true");
       params.put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, GZIPContentEncodingFilter.class.getName());
       params.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, GZIPContentEncodingFilter.class.getName());
-      filter("/*").through(GuiceContainer.class, params);
+      filter("/*").through(getWebAppFilterClass(), params);
     }
+  }
 
+  protected Class<? extends GuiceContainer> getWebAppFilterClass() {
+    return GuiceContainer.class;
   }
 
   /**
@@ -274,4 +281,5 @@ public abstract class WebApp extends Ser
   }
 
   public abstract void setup();
+
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java?rev=1577409&r1=1577408&r2=1577409&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java
Fri Mar 14 02:40:28 2014
@@ -29,11 +29,12 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.security.QueueACLsManager;
 import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
-import org.apache.hadoop.yarn.webapp.Dispatcher;
 import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
 import org.apache.hadoop.yarn.webapp.WebApp;
 import org.apache.hadoop.yarn.webapp.YarnWebParams;
 
+import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
+
 /**
  * The RM webapp
  */
@@ -51,6 +52,8 @@ public class RMWebApp extends WebApp imp
     bind(JAXBContextResolver.class);
     bind(RMWebServices.class);
     bind(GenericExceptionHandler.class);
+    bind(RMWebApp.class).toInstance(this);
+
     if (rm != null) {
       bind(ResourceManager.class).toInstance(rm);
       bind(RMContext.class).toInstance(rm.getRMContext());
@@ -68,17 +71,8 @@ public class RMWebApp extends WebApp imp
   }
 
   @Override
-  public void configureServlets() {
-    setup();
-
-    serve("/").with(RMDispatcher.class);
-    serve("/__stop").with(Dispatcher.class);
-
-    for (String path : super.getServePathSpecs()) {
-      serve(path).with(RMDispatcher.class);
-    }
-
-    configureRSServlets();
+  protected Class<? extends GuiceContainer> getWebAppFilterClass() {
+    return RMWebAppFilter.class;
   }
 
   public void checkIfStandbyRM() {



Mime
View raw message