YARN-2797. Add -help to yarn logs and nodes CLI command. Contributed by
Jagadesh Kiran N.
(cherry picked from commit b610c68d44
)
This commit is contained in:
parent
62e0e67d49
commit
b9e82e27f5
|
@ -285,6 +285,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
YARN-2797. TestWorkPreservingRMRestart should use ParametrizedSchedulerTestBase
|
YARN-2797. TestWorkPreservingRMRestart should use ParametrizedSchedulerTestBase
|
||||||
(Karthik Kambatla via xgong)
|
(Karthik Kambatla via xgong)
|
||||||
|
|
||||||
|
YARN-2797. Add -help to yarn logs and nodes CLI command.
|
||||||
|
(Jagadesh Kiran N via devaraj)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
YARN-2990. FairScheduler's delay-scheduling always waits for node-local and
|
YARN-2990. FairScheduler's delay-scheduling always waits for node-local and
|
||||||
|
|
|
@ -51,12 +51,15 @@ public class LogsCLI extends Configured implements Tool {
|
||||||
private static final String APPLICATION_ID_OPTION = "applicationId";
|
private static final String APPLICATION_ID_OPTION = "applicationId";
|
||||||
private static final String NODE_ADDRESS_OPTION = "nodeAddress";
|
private static final String NODE_ADDRESS_OPTION = "nodeAddress";
|
||||||
private static final String APP_OWNER_OPTION = "appOwner";
|
private static final String APP_OWNER_OPTION = "appOwner";
|
||||||
|
public static final String HELP_CMD = "help";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int run(String[] args) throws Exception {
|
public int run(String[] args) throws Exception {
|
||||||
|
|
||||||
Options opts = new Options();
|
Options opts = new Options();
|
||||||
Option appIdOpt = new Option(APPLICATION_ID_OPTION, true, "ApplicationId (required)");
|
opts.addOption(HELP_CMD, false, "Displays help for all commands.");
|
||||||
|
Option appIdOpt =
|
||||||
|
new Option(APPLICATION_ID_OPTION, true, "ApplicationId (required)");
|
||||||
appIdOpt.setRequired(true);
|
appIdOpt.setRequired(true);
|
||||||
opts.addOption(appIdOpt);
|
opts.addOption(appIdOpt);
|
||||||
opts.addOption(CONTAINER_ID_OPTION, true,
|
opts.addOption(CONTAINER_ID_OPTION, true,
|
||||||
|
@ -71,6 +74,7 @@ public class LogsCLI extends Configured implements Tool {
|
||||||
opts.getOption(APP_OWNER_OPTION).setArgName("Application Owner");
|
opts.getOption(APP_OWNER_OPTION).setArgName("Application Owner");
|
||||||
|
|
||||||
Options printOpts = new Options();
|
Options printOpts = new Options();
|
||||||
|
printOpts.addOption(opts.getOption(HELP_CMD));
|
||||||
printOpts.addOption(opts.getOption(CONTAINER_ID_OPTION));
|
printOpts.addOption(opts.getOption(CONTAINER_ID_OPTION));
|
||||||
printOpts.addOption(opts.getOption(NODE_ADDRESS_OPTION));
|
printOpts.addOption(opts.getOption(NODE_ADDRESS_OPTION));
|
||||||
printOpts.addOption(opts.getOption(APP_OWNER_OPTION));
|
printOpts.addOption(opts.getOption(APP_OWNER_OPTION));
|
||||||
|
@ -79,7 +83,10 @@ public class LogsCLI extends Configured implements Tool {
|
||||||
printHelpMessage(printOpts);
|
printHelpMessage(printOpts);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (args[0].equals("-help")) {
|
||||||
|
printHelpMessage(printOpts);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
CommandLineParser parser = new GnuParser();
|
CommandLineParser parser = new GnuParser();
|
||||||
String appIdStr = null;
|
String appIdStr = null;
|
||||||
String containerIdStr = null;
|
String containerIdStr = null;
|
||||||
|
|
|
@ -68,6 +68,7 @@ public class NodeCLI extends YarnCLI {
|
||||||
public int run(String[] args) throws Exception {
|
public int run(String[] args) throws Exception {
|
||||||
|
|
||||||
Options opts = new Options();
|
Options opts = new Options();
|
||||||
|
opts.addOption(HELP_CMD, false, "Displays help for all commands.");
|
||||||
opts.addOption(STATUS_CMD, true, "Prints the status report of the node.");
|
opts.addOption(STATUS_CMD, true, "Prints the status report of the node.");
|
||||||
opts.addOption(LIST_CMD, false, "List all running nodes. " +
|
opts.addOption(LIST_CMD, false, "List all running nodes. " +
|
||||||
"Supports optional use of -states to filter nodes " +
|
"Supports optional use of -states to filter nodes " +
|
||||||
|
@ -118,6 +119,9 @@ public class NodeCLI extends YarnCLI {
|
||||||
nodeStates.add(NodeState.RUNNING);
|
nodeStates.add(NodeState.RUNNING);
|
||||||
}
|
}
|
||||||
listClusterNodes(nodeStates);
|
listClusterNodes(nodeStates);
|
||||||
|
} else if (cliParser.hasOption(HELP_CMD)) {
|
||||||
|
printUsage(opts);
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
syserr.println("Invalid Command Usage : ");
|
syserr.println("Invalid Command Usage : ");
|
||||||
printUsage(opts);
|
printUsage(opts);
|
||||||
|
|
|
@ -149,6 +149,7 @@ public class TestLogsCLI {
|
||||||
pw.println(" not specified)");
|
pw.println(" not specified)");
|
||||||
pw.println(" -containerId <Container ID> ContainerId (must be specified if node");
|
pw.println(" -containerId <Container ID> ContainerId (must be specified if node");
|
||||||
pw.println(" address is specified)");
|
pw.println(" address is specified)");
|
||||||
|
pw.println(" -help Displays help for all commands.");
|
||||||
pw.println(" -nodeAddress <Node Address> NodeAddress in the format nodename:port");
|
pw.println(" -nodeAddress <Node Address> NodeAddress in the format nodename:port");
|
||||||
pw.println(" (must be specified if container id is");
|
pw.println(" (must be specified if container id is");
|
||||||
pw.println(" specified)");
|
pw.println(" specified)");
|
||||||
|
|
|
@ -1500,6 +1500,7 @@ public class TestYarnCLI {
|
||||||
PrintWriter pw = new PrintWriter(baos);
|
PrintWriter pw = new PrintWriter(baos);
|
||||||
pw.println("usage: node");
|
pw.println("usage: node");
|
||||||
pw.println(" -all Works with -list to list all nodes.");
|
pw.println(" -all Works with -list to list all nodes.");
|
||||||
|
pw.println(" -help Displays help for all commands.");
|
||||||
pw.println(" -list List all running nodes. Supports optional use of");
|
pw.println(" -list List all running nodes. Supports optional use of");
|
||||||
pw.println(" -states to filter nodes based on node state, all -all");
|
pw.println(" -states to filter nodes based on node state, all -all");
|
||||||
pw.println(" to list all nodes.");
|
pw.println(" to list all nodes.");
|
||||||
|
|
Loading…
Reference in New Issue