From 4790495538a15c56930a20ade2b090d1e1fd7940 Mon Sep 17 00:00:00 2001 From: Wangda Tan Date: Wed, 27 May 2015 15:34:17 -0700 Subject: [PATCH] YARN-3581. Deprecate -directlyAccessNodeLabelStore in RMAdminCLI. (Naganarasimha G R via wangda) (cherry picked from commit cab7674e54c4fe56838668462de99a6787841309) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../hadoop/yarn/client/cli/ClusterCLI.java | 2 +- .../hadoop/yarn/client/cli/RMAdminCLI.java | 22 +++++++++++-------- .../yarn/client/cli/TestClusterCLI.java | 4 +++- .../yarn/client/cli/TestRMAdminCLI.java | 13 ++++++----- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 58eb7ea4ee8..ea99f7fec68 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -223,6 +223,9 @@ Release 2.8.0 - UNRELEASED YARN-3647. RMWebServices api's should use updated api from CommonNodeLabelsManager to get NodeLabel object. (Sunil G via wangda) + YARN-3581. Deprecate -directlyAccessNodeLabelStore in RMAdminCLI. + (Naganarasimha G R via wangda) + OPTIMIZATIONS YARN-3339. TestDockerContainerExecutor should pull a single image and not diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ClusterCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ClusterCLI.java index 8765e411f27..b930014f95d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ClusterCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ClusterCLI.java @@ -73,7 +73,7 @@ public class ClusterCLI extends YarnCLI { "List cluster node-label collection"); opts.addOption("h", HELP_CMD, false, "Displays help for all commands."); opts.addOption("dnl", DIRECTLY_ACCESS_NODE_LABEL_STORE, false, - "Directly access node label store, " + "This is DEPRECATED, will be removed in future releases. Directly access node label store, " + "with this option, all node label related operations" + " will NOT connect RM. Instead, they will" + " access/modify stored node labels directly." 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 44abe6eff76..932b62d008d 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 @@ -109,20 +109,20 @@ public class RMAdminCLI extends HAAdmin { .put("-getGroups", new UsageInfo("[username]", "Get the groups which given user belongs to.")) .put("-addToClusterNodeLabels", - new UsageInfo("[label1(exclusive=true)," - + "label2(exclusive=false),label3]", - "add to cluster node labels ")) + new UsageInfo("<\"label1(exclusive=true)," + + "label2(exclusive=false),label3\">", + "add to cluster node labels. Default exclusivity is true")) .put("-removeFromClusterNodeLabels", - new UsageInfo("[label1,label2,label3] (label splitted by \",\")", + new UsageInfo(" (label splitted by \",\")", "remove from cluster node labels")) .put("-replaceLabelsOnNode", new UsageInfo( - "[node1[:port]=label1,label2 node2[:port]=label1,label2]", + "<\"node1[:port]=label1,label2 node2[:port]=label1,label2\">", "replace labels on nodes" + " (please note that we do not support specifying multiple" + " labels on a single host for now.)")) .put("-directlyAccessNodeLabelStore", - new UsageInfo("", "Directly access node label store, " + new UsageInfo("", "This is DEPRECATED, will be removed in future releases. Directly access node label store, " + "with this option, all node label related operations" + " will not connect RM. Instead, they will" + " access/modify stored node labels directly." @@ -222,9 +222,10 @@ public class RMAdminCLI extends HAAdmin { " [-refreshAdminAcls]" + " [-refreshServiceAcl]" + " [-getGroup [username]]" + - " [[-addToClusterNodeLabels [label1,label2,label3]]" + - " [-removeFromClusterNodeLabels [label1,label2,label3]]" + - " [-replaceLabelsOnNode [node1[:port]=label1,label2 node2[:port]=label1]" + + " [-addToClusterNodeLabels <\"label1(exclusive=true)," + + "label2(exclusive=false),label3\">]" + + " [-removeFromClusterNodeLabels ]" + + " [-replaceLabelsOnNode <\"node1[:port]=label1,label2 node2[:port]=label1\">]" + " [-directlyAccessNodeLabelStore]]"); if (isHAEnabled) { appendHAUsage(summary); @@ -681,6 +682,7 @@ public class RMAdminCLI extends HAAdmin { } else if ("-addToClusterNodeLabels".equals(cmd)) { if (i >= args.length) { System.err.println(NO_LABEL_ERR_MSG); + printUsage("", isHAEnabled); exitCode = -1; } else { exitCode = addToClusterNodeLabels(args[i]); @@ -688,6 +690,7 @@ public class RMAdminCLI extends HAAdmin { } else if ("-removeFromClusterNodeLabels".equals(cmd)) { if (i >= args.length) { System.err.println(NO_LABEL_ERR_MSG); + printUsage("", isHAEnabled); exitCode = -1; } else { exitCode = removeFromClusterNodeLabels(args[i]); @@ -695,6 +698,7 @@ public class RMAdminCLI extends HAAdmin { } else if ("-replaceLabelsOnNode".equals(cmd)) { if (i >= args.length) { System.err.println(NO_MAPPING_ERR_MSG); + printUsage("", isHAEnabled); exitCode = -1; } else { exitCode = replaceLabelsOnNodes(args[i]); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestClusterCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestClusterCLI.java index d9c7de9cef9..5a0f049504f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestClusterCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestClusterCLI.java @@ -137,7 +137,9 @@ public class TestClusterCLI { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(baos); pw.println("usage: yarn cluster"); - pw.println(" -dnl,--directly-access-node-label-store Directly access node label"); + pw.println(" -dnl,--directly-access-node-label-store This is DEPRECATED, will be"); + pw.println(" removed in future releases."); + pw.println(" Directly access node label"); pw.println(" store, with this option, all"); pw.println(" node label related operations"); pw.println(" will NOT connect RM. Instead,"); 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 f8f23f47bb1..a95412c9741 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 @@ -333,9 +333,9 @@ public class TestRMAdminCLI { "yarn rmadmin [-refreshQueues] [-refreshNodes [-g [timeout in seconds]]] [-refreshSuper" + "UserGroupsConfiguration] [-refreshUserToGroupsMappings] " + "[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" + - " [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" + - " [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " + - "[node1[:port]=label1,label2 node2[:port]=label1] [-directlyAccessNodeLabelStore]] " + + " [username]] [-addToClusterNodeLabels <\"label1(exclusive=true),label2(exclusive=false),label3\">]" + + " [-removeFromClusterNodeLabels ] [-replaceLabelsOnNode " + + "<\"node1[:port]=label1,label2 node2[:port]=label1\">] [-directlyAccessNodeLabelStore]] " + "[-help [cmd]]")); assertTrue(dataOut .toString() @@ -413,9 +413,10 @@ public class TestRMAdminCLI { "yarn rmadmin [-refreshQueues] [-refreshNodes [-g [timeout in seconds]]] [-refreshSuper" + "UserGroupsConfiguration] [-refreshUserToGroupsMappings] " + "[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" - + " [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" - + " [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " - + "[node1[:port]=label1,label2 node2[:port]=label1] [-directlyAccessNodeLabelStore]] " + + " [username]] [-addToClusterNodeLabels <\"label1(exclusive=true)," + + "label2(exclusive=false),label3\">]" + + " [-removeFromClusterNodeLabels ] [-replaceLabelsOnNode " + + "<\"node1[:port]=label1,label2 node2[:port]=label1\">] [-directlyAccessNodeLabelStore]] " + "[-transitionToActive [--forceactive] ] " + "[-transitionToStandby ] " + "[-getServiceState ] [-checkHealth ] [-help [cmd]]";