Skip to content

Commit 74084db

Browse files
committed
YARN-11536. Fix CheckStyle.
1 parent e93ad36 commit 74084db

File tree

1 file changed

+30
-16
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli

1 file changed

+30
-16
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RouterCLI.java

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,10 @@ private int handlePolicy(String[] args)
338338
"in the FederationStateStore.");
339339
Option formatOpt = new Option(null, "format", true,
340340
"Users can specify the file format using this option. " +
341-
"Currently, there are two supported file formats: XML and JSON. " +
341+
"Currently, there are one supported file formats: XML." +
342342
"These files contain the policy information for storing queue policies.");
343-
Option fileOpt = new Option(null, "file", true,
343+
Option fileOpt = new Option("f", "input-file", true,
344+
// TODO: 格式
344345
"Users can specify the file format using this option. " +
345346
"Currently, there are two supported file formats: XML and JSON. " +
346347
"These files contain the policy information for storing queue policies.");
@@ -370,24 +371,23 @@ private int handlePolicy(String[] args)
370371
}
371372
return handleSavePolicy(policy);
372373
}
373-
374374
// Save Queue Policies in Batches
375-
if (cliParser.hasOption(OPTION_BATCH_S) || cliParser.hasOption(OPTION_BATCH_SAVE)) {
375+
else if (cliParser.hasOption(OPTION_BATCH_S) || cliParser.hasOption(OPTION_BATCH_SAVE)) {
376376

377377
// Determine whether the file format is accurate, XML or JSON format.
378378
// If it is not XML or JSON, we will directly prompt the user with an error message.
379379
String format = null;
380380
if (cliParser.hasOption(OPTION_FORMAT)) {
381381
format = cliParser.getOptionValue(OPTION_FORMAT);
382382
if (StringUtils.isBlank(format) ||
383-
StringUtils.equalsAnyIgnoreCase(format, FORMAT_XML, FORMAT_JSON)) {
383+
!StringUtils.equalsAnyIgnoreCase(format, FORMAT_XML)) {
384384
System.out.println("We currently only support policy configuration files " +
385-
"in XML and JSON formats.");
385+
"in XML formats.");
386386
return EXIT_ERROR;
387387
}
388388
}
389389

390-
// Parse configuration file path
390+
// Parse configuration file path.
391391
String filePath = null;
392392
if (cliParser.hasOption(OPTION_FILE) || cliParser.hasOption(OPTION_INPUT_FILE)) {
393393
filePath = cliParser.getOptionValue(OPTION_FILE);
@@ -396,9 +396,12 @@ private int handlePolicy(String[] args)
396396
}
397397
}
398398

399-
handBatchSavePolicies(format, filePath);
400-
401-
System.out.println("We need to specify the format of the input file.");
399+
// Batch SavePolicies.
400+
return handBatchSavePolicies(format, filePath);
401+
}
402+
// printUsage
403+
else {
404+
printUsage(args[0]);
402405
}
403406

404407
return EXIT_ERROR;
@@ -507,6 +510,18 @@ protected int parseXml2Policies(String policiesXml) {
507510
return EXIT_ERROR;
508511
}
509512

513+
/**
514+
* Parse FederationQueueWeight from the xml configuration file.
515+
*
516+
* We allow users to provide an xml configuration file,
517+
* which stores the weight information of the queue.
518+
*
519+
* @param policiesXml
520+
* @return
521+
* @throws IOException
522+
* @throws SAXException
523+
* @throws ParserConfigurationException
524+
*/
510525
protected List<FederationQueueWeight> parsePoliciesByXml(String policiesXml)
511526
throws IOException, SAXException, ParserConfigurationException {
512527

@@ -614,14 +629,13 @@ public int run(String[] args) throws Exception {
614629
printHelp();
615630
}
616631
return EXIT_SUCCESS;
617-
}
618-
619-
if (CMD_DEREGISTERSUBCLUSTER.equals(cmd)) {
632+
} else if (CMD_DEREGISTERSUBCLUSTER.equals(cmd)) {
620633
return handleDeregisterSubCluster(args);
621-
}
622-
623-
if (CMD_POLICY.equals(cmd)) {
634+
} else if (CMD_POLICY.equals(cmd)) {
624635
return handlePolicy(args);
636+
} else {
637+
System.out.println("No related commands found.");
638+
printHelp();
625639
}
626640

627641
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)