hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ss...@apache.org
Subject svn commit: r1351878 - in /hadoop/common/branches/branch-2/hadoop-mapreduce-project: ./ hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/
Date Tue, 19 Jun 2012 22:02:48 GMT
Author: sseth
Date: Tue Jun 19 22:02:48 2012
New Revision: 1351878

URL: http://svn.apache.org/viewvc?rev=1351878&view=rev
Log:
Merge MAPREDUCE-4306 from trunk. Fix distributed shell to work with users other than the one
running the daemons. (Contributed by Ahmed Radwan)

Modified:
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt?rev=1351878&r1=1351877&r2=1351878&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt Tue Jun 19 22:02:48
2012
@@ -54,6 +54,9 @@ Release 2.0.1-alpha - UNRELEASED
     MAPREDUCE-3873. Fixed NodeManagers' decommissioning at RM to accept IP
     addresses also. (xieguiming via vinodkv)
 
+    MAPREDUCE-4306. Fix distributed shell to work with users other than the one
+    running the daemons. (Ahmed Radwan via sseth)
+
 Release 2.0.0-alpha - 05-23-2012
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java?rev=1351878&r1=1351877&r2=1351878&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java
Tue Jun 19 22:02:48 2012
@@ -44,7 +44,6 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.yarn.api.AMRMProtocol;
 import org.apache.hadoop.yarn.api.ApplicationConstants;
 import org.apache.hadoop.yarn.api.ContainerManager;
@@ -635,12 +634,10 @@ public class ApplicationMaster {
       ctx.setContainerId(container.getId());
       ctx.setResource(container.getResource());
 
-      try {
-        ctx.setUser(UserGroupInformation.getCurrentUser().getShortUserName());
-      } catch (IOException e) {
-        LOG.info("Getting current user info failed when trying to launch the container"
-            + e.getMessage());
-      }
+      String jobUserName = System.getenv(ApplicationConstants.Environment.USER
+          .name());
+      ctx.setUser(jobUserName);
+      LOG.info("Setting user in ContainerLaunchContext to: " + jobUserName);
 
       // Set the environment 
       ctx.setEnvironment(shellEnv);

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java?rev=1351878&r1=1351877&r2=1351878&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
Tue Jun 19 22:02:48 2012
@@ -95,7 +95,7 @@ import org.apache.hadoop.yarn.util.Recor
  * 
  * <p> For the actual job submission, the client first has to create an {@link ApplicationSubmissionContext}.

  * The {@link ApplicationSubmissionContext} defines the application details such as {@link
ApplicationId} 
- * and application name, user submitting the application, the priority assigned to the application
and the queue 
+ * and application name, the priority assigned to the application and the queue
  * to which this application needs to be assigned. In addition to this, the {@link ApplicationSubmissionContext}
  * also defines the {@link ContainerLaunchContext} which describes the <code>Container</code>
with which 
  * the {@link ApplicationMaster} is launched. </p>
@@ -132,8 +132,6 @@ public class Client {
   private int amPriority = 0;
   // Queue for App master
   private String amQueue = "";
-  // User to run app master as
-  private String amUser = "";
   // Amt. of memory resource to request for to run the App Master
   private int amMemory = 10; 
 
@@ -221,6 +219,7 @@ public class Client {
    * Parse command line options
    * @param args Parsed command line options 
    * @return Whether the init was successful to run the client
+   * @throws ParseException
    */
   public boolean init(String[] args) throws ParseException {
 
@@ -228,7 +227,6 @@ public class Client {
     opts.addOption("appname", true, "Application Name. Default value - DistributedShell");
     opts.addOption("priority", true, "Application Priority. Default 0");
     opts.addOption("queue", true, "RM Queue in which this application is to be submitted");
-    opts.addOption("user", true, "User to run the application as");
     opts.addOption("timeout", true, "Application timeout in milliseconds");
     opts.addOption("master_memory", true, "Amount of memory in MB to be requested to run
the application master");
     opts.addOption("jar", true, "Jar file containing the application master");
@@ -263,7 +261,6 @@ public class Client {
     appName = cliParser.getOptionValue("appname", "DistributedShell");
     amPriority = Integer.parseInt(cliParser.getOptionValue("priority", "0"));
     amQueue = cliParser.getOptionValue("queue", "");
-    amUser = cliParser.getOptionValue("user", "");
     amMemory = Integer.parseInt(cliParser.getOptionValue("master_memory", "10"));		
 
     if (amMemory < 0) {
@@ -567,10 +564,6 @@ public class Client {
     commands.add(command.toString());		
     amContainer.setCommands(commands);
 
-    // For launching an AM Container, setting user here is not needed
-    // Set user in ApplicationSubmissionContext
-    // amContainer.setUser(amUser);
-
     // Set up resource type requirements
     // For now, only memory is supported so we set memory requirements
     Resource capability = Records.newRecord(Resource.class);
@@ -594,9 +587,6 @@ public class Client {
 
     // Set the queue to which this application is to be submitted in the RM
     appContext.setQueue(amQueue);
-    // Set the user submitting this application 
-    // TODO can it be empty? 
-    appContext.setUser(amUser);
 
     // Create the request to send to the applications manager 
     SubmitApplicationRequest appRequest = Records.newRecord(SubmitApplicationRequest.class);



Mime
View raw message