YARN-2970. NodeLabel operations in RMAdmin CLI get missing in help command. (Contributed by Varun Saxena)

(cherry picked from commit e1ee0d45ea)
This commit is contained in:
Junping Du 2014-12-23 18:23:45 -08:00
parent 653b3fada2
commit ae3faab13e
3 changed files with 21 additions and 8 deletions

View File

@ -114,6 +114,9 @@ Release 2.7.0 - UNRELEASED
YARN-2949. Add documentation for CGroups (Varun Vasudev via junping_du)
YARN-2970. NodeLabel operations in RMAdmin CLI get missing in help command.
(Varun Saxena via junping_du)
OPTIMIZATIONS
BUG FIXES

View File

@ -93,9 +93,6 @@ public class RMAdminCLI extends HAAdmin {
"ResoureceManager will reload the authorization policy file."))
.put("-getGroups", new UsageInfo("[username]",
"Get the groups which given user belongs to."))
.put("-help", new UsageInfo("[cmd]",
"Displays help for the given command or all commands if none " +
"is specified."))
.put("-addToClusterNodeLabels",
new UsageInfo("[label1,label2,label3] (label splitted by \",\")",
"add to cluster node labels "))
@ -184,6 +181,7 @@ private static void buildUsageMsg(StringBuilder builder,
}
}
}
builder.append(" -help" + " [cmd]\n");
}
private static void printHelp(String cmd, boolean isHAEnabled) {
@ -199,10 +197,14 @@ private static void printHelp(String cmd, boolean isHAEnabled) {
" [-refreshAdminAcls]" +
" [-refreshServiceAcl]" +
" [-getGroup [username]]" +
" [-help [cmd]]");
" [[-addToClusterNodeLabels [label1,label2,label3]]" +
" [-removeFromClusterNodeLabels [label1,label2,label3]]" +
" [-replaceLabelsOnNode [node1:port,label1,label2 node2:port,label1]" +
" [-directlyAccessNodeLabelStore]]");
if (isHAEnabled) {
appendHAUsage(summary);
}
summary.append(" [-help [cmd]]");
summary.append("\n");
StringBuilder helpBuilder = new StringBuilder();
@ -219,6 +221,8 @@ private static void printHelp(String cmd, boolean isHAEnabled) {
}
}
}
helpBuilder.append(" -help [cmd]: Displays help for the given command or all commands" +
" if none is specified.");
System.out.println(helpBuilder);
System.out.println();
ToolRunner.printGenericCommandUsage(System.out);

View File

@ -279,7 +279,10 @@ public void testHelp() throws Exception {
"yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshSuper" +
"UserGroupsConfiguration] [-refreshUserToGroupsMappings] " +
"[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" +
" [username]] [-help [cmd]]"));
" [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" +
" [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " +
"[node1:port,label1,label2 node2:port,label1] [-directlyAccessNodeLabelStore]] " +
"[-help [cmd]]"));
assertTrue(dataOut
.toString()
.contains(
@ -358,10 +361,13 @@ public void testHelp() throws Exception {
"yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshSuper" +
"UserGroupsConfiguration] [-refreshUserToGroupsMappings] " +
"[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" +
" [username]] [-help [cmd]] [-transitionToActive <serviceId>" +
" [--forceactive]] [-transitionToStandby <serviceId>] [-failover" +
" [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" +
" [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " +
"[node1:port,label1,label2 node2:port,label1] [-directlyAccessNodeLabelStore]] " +
"[-transitionToActive <serviceId> [--forceactive]] " +
"[-transitionToStandby <serviceId>] [-failover" +
" [--forcefence] [--forceactive] <serviceId> <serviceId>] " +
"[-getServiceState <serviceId>] [-checkHealth <serviceId>]"));
"[-getServiceState <serviceId>] [-checkHealth <serviceId>] [-help [cmd]]"));
} finally {
System.setOut(oldOutPrintStream);
System.setErr(oldErrPrintStream);