use of org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest in project hadoop by apache.
the class RMAdminCLI method handleAddToClusterNodeLabels.
private int handleAddToClusterNodeLabels(String[] args, String cmd, boolean isHAEnabled) throws IOException, YarnException, ParseException {
Options opts = new Options();
opts.addOption("addToClusterNodeLabels", true, "Add to cluster node labels.");
opts.addOption("directlyAccessNodeLabelStore", false, "Directly access node label store.");
int exitCode = -1;
CommandLine cliParser = null;
try {
cliParser = new GnuParser().parse(opts, args);
} catch (MissingArgumentException ex) {
System.err.println(NO_LABEL_ERR_MSG);
printUsage(args[0], isHAEnabled);
return exitCode;
}
List<NodeLabel> labels = buildNodeLabelsFromStr(cliParser.getOptionValue("addToClusterNodeLabels"));
if (cliParser.hasOption("directlyAccessNodeLabelStore")) {
getNodeLabelManagerInstance(getConf()).addToCluserNodeLabels(labels);
} else {
ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
AddToClusterNodeLabelsRequest request = AddToClusterNodeLabelsRequest.newInstance(labels);
adminProtocol.addToClusterNodeLabels(request);
}
return 0;
}
Aggregations