diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java index 2b3415413ce..47bc2b6e1c3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java @@ -52,6 +52,7 @@ import org.apache.hadoop.yarn.api.records.SignalContainerCommand; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.client.api.AppAdminClient; +import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; @@ -113,6 +114,7 @@ public static final String VERSION = "version"; public static final String STATES = "states"; public static final String SHELL_CMD = "shell"; + public static final String CLUSTER_ID_OPTION = "clusterId"; private static String firstArg = null; @@ -278,6 +280,8 @@ public int run(String[] args) throws Exception { "the ability to finalize the upgrade automatically."); opts.addOption(UPGRADE_CANCEL, false, "Works with -upgrade option to " + "cancel current upgrade."); + opts.addOption(CLUSTER_ID_OPTION, true, "ClusterId. " + + "By default, it will take default cluster id from the RM"); opts.getOption(LAUNCH_CMD).setArgName("Application Name> ClusterId. By default, it will"); + pw.println(" take default cluster id from the"); + pw.println(" RM"); pw.println(" -component Works with -flex option to"); pw.println(" change the number of"); pw.println(" components/containers running"); @@ -2298,6 +2301,8 @@ private String createApplicationAttemptCLIHelpMessage() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(baos); pw.println("usage: applicationattempt"); + pw.println(" -clusterId ClusterId. By default, it will take"); + pw.println(" default cluster id from the RM"); pw.println(" -fail Fails application attempt."); pw.println(" -help Displays help for all commands."); pw.println(" -list List application attempts for"); @@ -2314,6 +2319,7 @@ private String createContainerCLIHelpMessage() throws IOException { PrintWriter pw = new PrintWriter(baos); pw.println("usage: container"); pw.println(" -appTypes Works with -list to specify the app type when application name is provided."); + pw.println(" -clusterId ClusterId. By default, it will take default cluster id from the RM "); pw.println(" -components Works with -list to filter instances based on input comma-separated list of component names."); pw.println(" -help Displays help for all commands."); pw.println(" -list List containers for application attempt when application attempt ID is provided. When application name is provided, then it finds the instances of the application based on app's own implementation, and -appTypes option must be specified unless it is the default yarn-service type. With app name, it supports optional use of -version to filter instances based on app version, -components to filter instances based on component names, -states to filter instances based on instance state.");