slfan1989 commented on code in PR #5302:
URL: https://github.com/apache/hadoop/pull/5302#discussion_r1072906418
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java:
##########
@@ -1345,16 +1350,124 @@ public LabelsToNodesInfo getLabelsToNodes(Set<String>
labels)
"getLabelsToNodes by labels = %s Failed.", StringUtils.join(labels,
","));
}
+ /**
+ * This method replaces all the node labels for specific nodes, and it is
+ * reachable by using {@link RMWSConsts#REPLACE_NODE_TO_LABELS}.
+ *
+ * @see ResourceManagerAdministrationProtocol#replaceLabelsOnNode
+ * @param newNodeToLabels the list of new labels. It is a content param.
+ * @param hsr the servlet request
+ * @return Response containing the status code
+ * @throws IOException if an exception happened
+ */
@Override
public Response replaceLabelsOnNodes(NodeToLabelsEntryList newNodeToLabels,
HttpServletRequest hsr) throws IOException {
- throw new NotImplementedException("Code is not implemented");
+ try {
+ // Step1. Check the parameters to ensure that the parameters are not
empty.
+ if (newNodeToLabels == null) {
+ throw new IllegalArgumentException("Parameter error, newNodeToLabels
must not be empty.");
+ }
+ List<NodeToLabelsEntry> nodeToLabelsEntries =
newNodeToLabels.getNodeToLabels();
+ if(CollectionUtils.isEmpty(nodeToLabelsEntries)){
Review Comment:
I will fix it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]