[
https://issues.apache.org/jira/browse/YARN-11517?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736819#comment-17736819
]
ASF GitHub Bot commented on YARN-11517:
---
slfan1989 commented on code in PR #5766:
URL: https://github.com/apache/hadoop/pull/5766#discussion_r1241044630
##
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRouterCLI.java:
##
@@ -120,7 +122,10 @@ public void testDeregisterSubCluster() throws Exception {
ByteArrayOutputStream dataOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(dataOut));
oldOutPrintStream.println(dataOut);
-String[] args = {"-deregisterSubCluster", "-c", "SC-1"};
+String[] args = {"-deregisterSubCluster", "-sc", "SC-1"};
Review Comment:
Thanks for your question! You are correct that in general, a single
character follows the hyphen "-". Our short option hopes to express
`subcluster`, maybe `sc` is better than `c`?
- RouterCLI#handleDeregisterSubCluster
```
private static final String OPTION_SC = "sc";
private static final String OPTION_SUBCLUSTERID = "subClusterId";
Option subClusterOpt = new Option(OPTION_SC, OPTION_SUBCLUSTERID, true,
"The subCluster can be specified using either the '-sc' or
'--subCluster' option. " +
" If the subCluster's Heartbeat Timeout, it will be marked as
'SC_LOST'.");
```
- org.apache.commons.cli.Option
For Options, we set short options using a hyphen `-` and long options using
two hyphens `--` when using the command.
```
/**
* Creates an Option using the specified parameters.
*
* @param option short representation of the option
* @param longOption the long representation of the option
* @param hasArg specifies whether the Option takes an argument or not
* @param description describes the function of the option
*
* @throws IllegalArgumentException if there are any non valid Option
characters in {@code opt}.
*/
public Option(final String option, final String longOption, final
boolean hasArg, final String description) throws IllegalArgumentException {
// ensure that the option is valid
this.option = OptionValidator.validate(option);
this.longOption = longOption;
// if hasArg is set then the number of arguments is 1
if (hasArg) {
this.argCount = 1;
}
this.description = description;
}
```
Our short option is set as `sc`, so it should be used as `-sc` when using
the command. The long option is set as `subClusterId`, so it should be used as
`--subClusterId` when using the command.
> Improve Federation#RouterCLI deregisterSubCluster Code
> --
>
> Key: YARN-11517
> URL: https://issues.apache.org/jira/browse/YARN-11517
> Project: Hadoop YARN
> Issue Type: Sub-task
> Components: federation, router
>Reporter: Shilun Fan
>Assignee: Shilun Fan
>Priority: Major
> Labels: pull-request-available
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
-
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org