YARN-10465. Support getNodeToLabels, getLabelsToNodes, getClusterNodeLabels API's for Federation#4317
Conversation
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
Hi, @goiri , YARN-10465:Support getNodeToLabels, getLabelsToNodes, getClusterNodeLabels API's for Federation, It has been done in this pr, please help to review the code, thank you very much! |
There was a problem hiding this comment.
ApplicationClientProtocol client inside the try
There was a problem hiding this comment.
It looks like we do this pattern a bunch of time.
Maybe we can generalizer this with some lambda passed as a parameter?
There was a problem hiding this comment.
Is it possible to design a generic function like this?
private <R> Collection<R> invokeAppClientProtocolMethod(
Boolean filterInactiveSubClusters, ClientMethod request, Class<R> clazz)
throws YarnException, RuntimeException {
Map<SubClusterId, SubClusterInfo> subClusters =
federationFacade.getSubClusters(filterInactiveSubClusters);
return subClusters.keySet().stream().map(subClusterId -> {
try {
ApplicationClientProtocol protocol =
getClientRMProxyForSubCluster(subClusterId);
Method method = ApplicationClientProtocol.class
.getMethod(request.getMethodName(), request.getTypes());
return clazz.cast(method.invoke(protocol, request.getParams()));
} catch (YarnException | NoSuchMethodException | IllegalAccessException |
InvocationTargetException ex) {
throw new RuntimeException(ex);
}
}).collect(Collectors.toList());
}
...outer/src/main/java/org/apache/hadoop/yarn/server/router/clientrm/RouterYarnClientUtils.java
Show resolved
Hide resolved
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
Hi, @goiri please help to review the code again,thank you very much! |
|
Hi, @goiri ,Thanks for your help reviewing the code, Can you help with merging into the trunk branch? |
…Labels API's for Federation (apache#4317)
Description of PR
JIRA: https://issues.apache.org/jira/browse/YARN-10465
getNodeToLabels, getLabelsToNodes, getClusterNodeLabels API's are not implemented under the Yarn Federation framework, implement the methods.
How was this patch tested?
Added Junit Test to test normal requests and NULL requests, all as expected
For code changes:
1.Use the loop method to call the getNodeToLabels, getLabelsToNodes, getClusterNodeLabels method of the subcluster one by one
2.Complete the Metric indicator counting function