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 480ea231fbe..196ec2ec969 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 @@ -51,6 +51,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; @@ -64,7 +65,7 @@ @Private @Unstable public class ApplicationCLI extends YarnCLI { - private static final String APPLICATIONS_PATTERN = + private static final String APPLICATIONS_PATTERN = "%30s\t%20s\t%20s\t%10s\t%10s\t%18s\t%18s\t%15s\t%35s" + System.getProperty("line.separator"); private static final String APPLICATION_ATTEMPTS_PATTERN = @@ -111,6 +112,7 @@ public static final String COMPONENTS = "components"; public static final String VERSION = "version"; public static final String STATES = "states"; + public static final String CLUSTER_ID_OPTION = "clusterId"; private static String firstArg = null; @@ -276,6 +278,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.");