diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java index 7906e6f..97b2460 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java @@ -346,6 +346,7 @@ public ApplicationMaster() { * @throws ParseException * @throws IOException */ + @SuppressWarnings("deprecation") public boolean init(String[] args) throws ParseException, IOException { Options opts = new Options(); opts.addOption("app_attempt_id", true, @@ -428,7 +429,7 @@ public boolean init(String[] args) throws ParseException, IOException { + ", attemptId=" + appAttemptID.getAttemptId()); if (!fileExist(shellCommandPath) - && envs.get(DSConstants.DISTRIBUTEDSHELLSCRIPTLOCATION).isEmpty()) { + && envs.get(DSConstants.DISTRIBUTED_SHELL_SCRIPT_LOCATION).isEmpty()) { throw new IllegalArgumentException( "No shell command or shell script specified to be executed by application master"); } @@ -459,14 +460,27 @@ public boolean init(String[] args) throws ParseException, IOException { } } - if (envs.containsKey(DSConstants.DISTRIBUTEDSHELLSCRIPTLOCATION)) { - scriptPath = envs.get(DSConstants.DISTRIBUTEDSHELLSCRIPTLOCATION); - - if (envs.containsKey(DSConstants.DISTRIBUTEDSHELLSCRIPTTIMESTAMP)) { + if (envs.containsKey(DSConstants.DISTRIBUTED_SHELL_SCRIPT_LOCATION) || + envs.containsKey(DSConstants.DISTRIBUTEDSHELLSCRIPTLOCATION)) { + scriptPath = envs.get(DSConstants.DISTRIBUTED_SHELL_SCRIPT_LOCATION); + if (scriptPath == null || scriptPath.length() == 0) { + scriptPath = envs.get(DSConstants.DISTRIBUTEDSHELLSCRIPTLOCATION); + } + if (envs.containsKey(DSConstants.DISTRIBUTED_SHELL_SCRIPT_TIMESTAMP)) { + shellScriptPathTimestamp = Long.valueOf(envs + .get(DSConstants.DISTRIBUTED_SHELL_SCRIPT_TIMESTAMP)); + } + if (shellScriptPathTimestamp == 0 && + envs.containsKey(DSConstants.DISTRIBUTEDSHELLSCRIPTTIMESTAMP)) { shellScriptPathTimestamp = Long.valueOf(envs .get(DSConstants.DISTRIBUTEDSHELLSCRIPTTIMESTAMP)); } - if (envs.containsKey(DSConstants.DISTRIBUTEDSHELLSCRIPTLEN)) { + if (envs.containsKey(DSConstants.DISTRIBUTED_SHELL_SCRIPT_LEN)) { + shellScriptPathLen = Long.valueOf(envs + .get(DSConstants.DISTRIBUTED_SHELL_SCRIPT_LEN)); + } + if (shellScriptPathLen == 0 && + envs.containsKey(DSConstants.DISTRIBUTEDSHELLSCRIPTLEN)) { shellScriptPathLen = Long.valueOf(envs .get(DSConstants.DISTRIBUTEDSHELLSCRIPTLEN)); } @@ -480,8 +494,8 @@ public boolean init(String[] args) throws ParseException, IOException { } } - if (envs.containsKey(DSConstants.DISTRIBUTEDSHELLTIMELINEDOMAIN)) { - domainId = envs.get(DSConstants.DISTRIBUTEDSHELLTIMELINEDOMAIN); + if (envs.containsKey(DSConstants.DISTRIBUTED_SHELL_TIMELINE_DOMAIN)) { + domainId = envs.get(DSConstants.DISTRIBUTED_SHELL_TIMELINE_DOMAIN); } containerMemory = Integer.parseInt(cliParser.getOptionValue( 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 0e9a4e4..2ba1117 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 @@ -580,11 +580,11 @@ public boolean run() throws IOException, YarnException { // put location of shell script into env // using the env info, the application master will create the correct local resource for the // eventual containers that will be launched to execute the shell scripts - env.put(DSConstants.DISTRIBUTEDSHELLSCRIPTLOCATION, hdfsShellScriptLocation); - env.put(DSConstants.DISTRIBUTEDSHELLSCRIPTTIMESTAMP, Long.toString(hdfsShellScriptTimestamp)); - env.put(DSConstants.DISTRIBUTEDSHELLSCRIPTLEN, Long.toString(hdfsShellScriptLen)); + env.put(DSConstants.DISTRIBUTED_SHELL_SCRIPT_LOCATION, hdfsShellScriptLocation); + env.put(DSConstants.DISTRIBUTED_SHELL_SCRIPT_TIMESTAMP, Long.toString(hdfsShellScriptTimestamp)); + env.put(DSConstants.DISTRIBUTED_SHELL_SCRIPT_LEN, Long.toString(hdfsShellScriptLen)); if (domainId != null && domainId.length() > 0) { - env.put(DSConstants.DISTRIBUTEDSHELLTIMELINEDOMAIN, domainId); + env.put(DSConstants.DISTRIBUTED_SHELL_TIMELINE_DOMAIN, domainId); } // Add AppMaster.jar location to classpath diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/DSConstants.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/DSConstants.java index fbaf2d4..3ecc326 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/DSConstants.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/DSConstants.java @@ -31,22 +31,31 @@ /** * Environment key name pointing to the shell script's location */ + public static final String DISTRIBUTED_SHELL_SCRIPT_LOCATION = "DISTRIBUTED_SHELL_SCRIPT_LOCATION"; + + @Deprecated public static final String DISTRIBUTEDSHELLSCRIPTLOCATION = "DISTRIBUTEDSHELLSCRIPTLOCATION"; /** * Environment key name denoting the file timestamp for the shell script. * Used to validate the local resource. */ + public static final String DISTRIBUTED_SHELL_SCRIPT_TIMESTAMP = "DISTRIBUTED_SHELL_SCRIPT_TIMESTAMP"; + + @Deprecated public static final String DISTRIBUTEDSHELLSCRIPTTIMESTAMP = "DISTRIBUTEDSHELLSCRIPTTIMESTAMP"; /** * Environment key name denoting the file content length for the shell script. * Used to validate the local resource. */ + public static final String DISTRIBUTED_SHELL_SCRIPT_LEN = "DISTRIBUTED_SHELL_SCRIPT_LEN"; + + @Deprecated public static final String DISTRIBUTEDSHELLSCRIPTLEN = "DISTRIBUTEDSHELLSCRIPTLEN"; /** * Environment key name denoting the timeline domain ID. */ - public static final String DISTRIBUTEDSHELLTIMELINEDOMAIN = "DISTRIBUTEDSHELLTIMELINEDOMAIN"; + public static final String DISTRIBUTED_SHELL_TIMELINE_DOMAIN = "DISTRIBUTED_SHELL_TIMELINE_DOMAIN"; }