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-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 OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

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

View File

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