hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r1332704 - in /hadoop/common/branches/branch-0.23/hadoop-mapreduce-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/
Date Tue, 01 May 2012 15:37:19 GMT
Author: bobby
Date: Tue May  1 15:37:18 2012
New Revision: 1332704

URL: http://svn.apache.org/viewvc?rev=1332704&view=rev
Log:
svn merge -c 1332701 FIXES: MAPREDUCE-4211. Error conditions (missing appid, appid not found)
are masked in the RM app page (Jonathan Eagles via bobby)

Modified:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppBlock.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt?rev=1332704&r1=1332703&r2=1332704&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt Tue May  1 15:37:18
2012
@@ -164,6 +164,9 @@ Release 0.23.3 - UNRELEASED
     MAPREDUCE-4212. TestJobClientGetJob sometimes fails 
     (Daryn Sharp via tgraves)
 
+    MAPREDUCE-4211. Error conditions (missing appid, appid not found) are 
+    masked in the RM app page (Jonathan Eagles via bobby)
+
 Release 0.23.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppBlock.java?rev=1332704&r1=1332703&r2=1332704&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppBlock.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppBlock.java
Tue May  1 15:37:18 2012
@@ -18,21 +18,85 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager.webapp;
 
+import static org.apache.hadoop.yarn.util.StringHelper.join;
+import static org.apache.hadoop.yarn.webapp.YarnWebParams.APPLICATION_ID;
+
+import com.google.inject.Inject;
+
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
+import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
+import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
+import org.apache.hadoop.yarn.util.Apps;
+import org.apache.hadoop.yarn.util.Times;
 import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 import org.apache.hadoop.yarn.webapp.view.InfoBlock;
-
-import com.google.inject.Inject;
+import org.apache.hadoop.yarn.webapp.ResponseInfo;
 
 public class AppBlock extends HtmlBlock {
 
+  private ApplicationACLsManager aclsManager;
+  
   @Inject
-  AppBlock(ResourceManager rm, ViewContext ctx) {
+  AppBlock(ResourceManager rm, ViewContext ctx, ApplicationACLsManager aclsManager) {
     super(ctx);
+    this.aclsManager = aclsManager;
   }
 
   @Override
   protected void render(Block html) {
+    String aid = $(APPLICATION_ID);
+    if (aid.isEmpty()) {
+      puts("Bad request: requires application ID");
+      return;
+    }
+    ApplicationId appID = Apps.toAppID(aid);
+    RMContext context = getInstance(RMContext.class);
+    RMApp rmApp = context.getRMApps().get(appID);
+    if (rmApp == null) {
+      puts("Application not found: "+ aid);
+      return;
+    }
+    AppInfo app = new AppInfo(rmApp, true);
+
+    // Check for the authorization.
+    String remoteUser = request().getRemoteUser();
+    UserGroupInformation callerUGI = null;
+    if (remoteUser != null) {
+      callerUGI = UserGroupInformation.createRemoteUser(remoteUser);
+    }
+    if (callerUGI != null
+        && !this.aclsManager.checkAccess(callerUGI,
+            ApplicationAccessType.VIEW_APP, app.getUser(), appID)) {
+      puts("You (User " + remoteUser
+          + ") are not authorized to view the logs for application " + appID);
+      return;
+    }
+
+    setTitle(join("Application ", aid));
+
+    ResponseInfo info = info("Application Overview").
+      _("User:", app.getUser()).
+      _("Name:", app.getName()).
+      _("State:", app.getState()).
+      _("FinalStatus:", app.getFinalStatus()).
+      _("Started:", Times.format(app.getStartTime())).
+      _("Elapsed:", StringUtils.formatTime(
+        Times.elapsed(app.getStartTime(), app.getFinishTime()))).
+      _("Tracking URL:", !app.isTrackingUrlReady() ?
+        "#" : app.getTrackingUrlPretty(), app.getTrackingUI()).
+      _("Diagnostics:", app.getNote());
+    if (app.amContainerLogsExist()) {
+      info._("AM container logs:", app.getAMContainerLogs(), app.getAMContainerLogs());
+    } else {
+      info._("AM container logs:", "");
+    }
+
     html._(InfoBlock.class);
   }
 }

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java?rev=1332704&r1=1332703&r2=1332704&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
Tue May  1 15:37:18 2012
@@ -20,27 +20,12 @@ package org.apache.hadoop.yarn.server.re
 
 import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebApp.QUEUE_NAME;
 import static org.apache.hadoop.yarn.util.StringHelper.join;
-import static org.apache.hadoop.yarn.webapp.YarnWebParams.APPLICATION_ID;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
-import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
-import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
-import org.apache.hadoop.yarn.util.Apps;
 import org.apache.hadoop.yarn.util.StringHelper;
-import org.apache.hadoop.yarn.util.Times;
 import org.apache.hadoop.yarn.webapp.Controller;
-import org.apache.hadoop.yarn.webapp.ResponseInfo;
 import org.apache.hadoop.yarn.webapp.YarnWebParams;
 
 import com.google.inject.Inject;
@@ -49,12 +34,9 @@ import com.google.inject.Inject;
 // on Mac OS HFS as its case-insensitive!
 public class RmController extends Controller {
 
-  private ApplicationACLsManager aclsManager;
-
   @Inject
-  RmController(RequestContext ctx, ApplicationACLsManager aclsManager) {
+  RmController(RequestContext ctx) {
     super(ctx);
-    this.aclsManager = aclsManager;
   }
 
   @Override public void index() {
@@ -67,57 +49,6 @@ public class RmController extends Contro
   }
 
   public void app() {
-    String aid = $(APPLICATION_ID);
-    if (aid.isEmpty()) {
-      setStatus(HttpServletResponse.SC_BAD_REQUEST);
-      setTitle("Bad request: requires application ID");
-      return;
-    }
-    ApplicationId appID = Apps.toAppID(aid);
-    RMContext context = getInstance(RMContext.class);
-    RMApp rmApp = context.getRMApps().get(appID);
-    if (rmApp == null) {
-      // TODO: handle redirect to jobhistory server
-      setStatus(HttpServletResponse.SC_NOT_FOUND);
-      setTitle("Application not found: "+ aid);
-      return;
-    }
-    AppInfo app = new AppInfo(rmApp, true);
-
-    // Check for the authorization.
-    String remoteUser = request().getRemoteUser();
-    UserGroupInformation callerUGI = null;
-    if (remoteUser != null) {
-      callerUGI = UserGroupInformation.createRemoteUser(remoteUser);
-    }
-    if (callerUGI != null
-        && !this.aclsManager.checkAccess(callerUGI,
-            ApplicationAccessType.VIEW_APP, app.getUser(), appID)) {
-      setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-      setTitle("Unauthorized request for viewing application " + appID);
-      renderText("You (User " + remoteUser
-          + ") are not authorized to view the logs for application " + appID);
-      return;
-    }
-
-    setTitle(join("Application ", aid));
-
-    ResponseInfo info = info("Application Overview").
-      _("User:", app.getUser()).
-      _("Name:", app.getName()).
-      _("State:", app.getState()).
-      _("FinalStatus:", app.getFinalStatus()).
-      _("Started:", Times.format(app.getStartTime())).
-      _("Elapsed:", StringUtils.formatTime(
-        Times.elapsed(app.getStartTime(), app.getFinishTime()))).
-      _("Tracking URL:", !app.isTrackingUrlReady() ?
-        "#" : app.getTrackingUrlPretty(), app.getTrackingUI()).
-      _("Diagnostics:", app.getNote());
-    if (app.amContainerLogsExist()) {
-      info._("AM container logs:", app.getAMContainerLogs(), app.getAMContainerLogs());
-    } else {
-      info._("AM container logs:", "");
-    }
     render(AppPage.class);
   }
 



Mime
View raw message