use of org.apache.hadoop.yarn.server.api.protocolrecords.RemoveFromClusterNodeLabelsRequest in project hadoop by apache.
the class RMAdminCLI method handleRemoveFromClusterNodeLabels.
private int handleRemoveFromClusterNodeLabels(String[] args, String cmd, boolean isHAEnabled) throws IOException, YarnException, ParseException {
Options opts = new Options();
opts.addOption("removeFromClusterNodeLabels", true, "Remove From 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;
}
Set<String> labels = buildNodeLabelNamesFromStr(cliParser.getOptionValue("removeFromClusterNodeLabels"));
if (cliParser.hasOption("directlyAccessNodeLabelStore")) {
getNodeLabelManagerInstance(getConf()).removeFromClusterNodeLabels(labels);
} else {
ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
RemoveFromClusterNodeLabelsRequest request = RemoveFromClusterNodeLabelsRequest.newInstance(labels);
adminProtocol.removeFromClusterNodeLabels(request);
}
return 0;
}
Aggregations