diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java index 3336ed9..8322eb6 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java @@ -75,7 +75,6 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.util.ConverterUtils; -import org.apache.hadoop.yarn.util.Records; /** * Client for Distributed Shell application submission to YARN. @@ -456,9 +455,6 @@ public boolean run() throws IOException, YarnException { appContext.setKeepContainersAcrossApplicationAttempts(keepContainers); appContext.setApplicationName(appName); - // Set up the container launch context for the application master - ContainerLaunchContext amContainer = Records.newRecord(ContainerLaunchContext.class); - // set local resources for the application master // local files or archives as needed // In this scenario, the jar file for the application master is part of the local resources @@ -508,8 +504,6 @@ public boolean run() throws IOException, YarnException { addToLocalResources(fs, null, shellArgsPath, appId.toString(), localResources, StringUtils.join(shellArgs, " ")); } - // Set local resource info into app master container launch context - amContainer.setLocalResources(localResources); // Set the necessary security tokens as needed //amContainer.setContainerTokens(containerToken); @@ -550,8 +544,6 @@ public boolean run() throws IOException, YarnException { env.put("CLASSPATH", classPathEnv.toString()); - amContainer.setEnvironment(env); - // Set the necessary command to execute the application master Vector vargs = new Vector(30); @@ -587,14 +579,15 @@ public boolean run() throws IOException, YarnException { LOG.info("Completed setting up app master command " + command.toString()); List commands = new ArrayList(); commands.add(command.toString()); - amContainer.setCommands(commands); + + // Set up the container launch context for the application master + ContainerLaunchContext amContainer = ContainerLaunchContext.newInstance( + localResources, env, commands, null, null, null); // Set up resource type requirements // For now, both memory and vcores are supported, so we set memory and // vcores requirements - Resource capability = Records.newRecord(Resource.class); - capability.setMemory(amMemory); - capability.setVirtualCores(amVCores); + Resource capability = Resource.newInstance(amMemory, amVCores); appContext.setResource(capability); // Service data is a binary blob that can be passed to the application @@ -603,6 +596,7 @@ public boolean run() throws IOException, YarnException { // Setup security tokens if (UserGroupInformation.isSecurityEnabled()) { + // Note: Credentials class is marked as LimitedPrivate for HDFS and MapReduce Credentials credentials = new Credentials(); String tokenRenewer = conf.get(YarnConfiguration.RM_PRINCIPAL); if (tokenRenewer == null || tokenRenewer.length() == 0) { @@ -627,9 +621,8 @@ public boolean run() throws IOException, YarnException { appContext.setAMContainerSpec(amContainer); // Set the priority for the application master - Priority pri = Records.newRecord(Priority.class); // TODO - what is the range for priority? how to decide? - pri.setPriority(amPriority); + Priority pri = Priority.newInstance(amPriority); appContext.setPriority(pri); // Set the queue to which this application is to be submitted in the RM