minni31 commented on a change in pull request #3760:
URL: https://github.com/apache/hadoop/pull/3760#discussion_r795686854
##########
File path:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/LocalityMulticastAMRMProxyPolicy.java
##########
@@ -483,6 +502,73 @@ private float getHeadroomWeighting(SubClusterId targetId,
return headroomWeighting;
}
+ /**
+ * When certain subcluster is too loaded, reroute Node requests going there.
+ */
+ protected SubClusterId routeNodeRequestIfNeeded(SubClusterId targetId,
+ int maxThreshold, Set<SubClusterId> activeAndEnabledSCs) {
+ // If targetId is not in the active and enabled SC list, reroute the
traffic
+ if (activeAndEnabledSCs.contains(targetId)) {
+ int targetPendingCount = getSubClusterLoad(targetId);
+ if (targetPendingCount == -1 || targetPendingCount < maxThreshold) {
+ return targetId;
+ }
+ }
+ SubClusterId scId = pickSubClusterIdForMaxLoadSC(targetId, maxThreshold,
+ activeAndEnabledSCs);
+ return scId;
+ }
+
+ private SubClusterId pickSubClusterIdForMaxLoadSC(SubClusterId targetId,
+ int maxThreshold, Set<SubClusterId> activeAndEnabledSCs) {
+ ArrayList<Float> weights = new ArrayList<>();
+ ArrayList<SubClusterId> scIds = new ArrayList<>();
+ int targetLoad = getSubClusterLoad(targetId);
+ if (targetLoad == -1) {
+ // Probably a SC that's not active and enabled. Forcing a reroute
+ targetLoad = Integer.MAX_VALUE;
Review comment:
It is used to set targetLoad to MAX_VALUE if sc is not enable.
--
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]