From ae3faab13eaf784aea74ea48f1e2684d73f1430b Mon Sep 17 00:00:00 2001 From: Junping Du Date: Tue, 23 Dec 2014 18:23:45 -0800 Subject: [PATCH] YARN-2970. NodeLabel operations in RMAdmin CLI get missing in help command. (Contributed by Varun Saxena) (cherry picked from commit e1ee0d45ea3315e7fbe1d28a7a35a0ce0c54483b) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../apache/hadoop/yarn/client/cli/RMAdminCLI.java | 12 ++++++++---- .../hadoop/yarn/client/cli/TestRMAdminCLI.java | 14 ++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 3ed97af3cd4..6daef602737 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -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 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java index af2321eb881..9ea333cab4c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java @@ -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 @@ public class RMAdminCLI extends HAAdmin { } } } + builder.append(" -help" + " [cmd]\n"); } private static void printHelp(String cmd, boolean isHAEnabled) { @@ -199,10 +197,14 @@ public class RMAdminCLI extends HAAdmin { " [-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 @@ 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(); ToolRunner.printGenericCommandUsage(System.out); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java index 69b79dad559..73c3795895f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java @@ -279,7 +279,10 @@ public class TestRMAdminCLI { "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 class TestRMAdminCLI { "yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshSuper" + "UserGroupsConfiguration] [-refreshUserToGroupsMappings] " + "[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" + - " [username]] [-help [cmd]] [-transitionToActive " + - " [--forceactive]] [-transitionToStandby ] [-failover" + + " [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" + + " [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " + + "[node1:port,label1,label2 node2:port,label1] [-directlyAccessNodeLabelStore]] " + + "[-transitionToActive [--forceactive]] " + + "[-transitionToStandby ] [-failover" + " [--forcefence] [--forceactive] ] " + - "[-getServiceState ] [-checkHealth ]")); + "[-getServiceState ] [-checkHealth ] [-help [cmd]]")); } finally { System.setOut(oldOutPrintStream); System.setErr(oldErrPrintStream);