slfan1989 commented on code in PR #4656: URL: https://github.com/apache/hadoop/pull/4656#discussion_r933043084
########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/router/WeightedRandomRouterPolicy.java: ########## @@ -35,36 +35,21 @@ * sub-clusters. */ public class WeightedRandomRouterPolicy extends AbstractRouterPolicy { - @Override - public SubClusterId getHomeSubcluster( - ApplicationSubmissionContext appSubmissionContext, - List<SubClusterId> blacklist) throws YarnException { - - // null checks and default-queue behavior - validate(appSubmissionContext); - - Map<SubClusterId, SubClusterInfo> activeSubclusters = - getActiveSubclusters(); + protected SubClusterId chooseSubCluster( + String queue, Map<SubClusterId, SubClusterInfo> preSelectSubClusters) throws YarnException { - FederationPolicyUtils.validateSubClusterAvailability( - new ArrayList<SubClusterId>(activeSubclusters.keySet()), blacklist); - - // note: we cannot pre-compute the weights, as the set of activeSubcluster + // note: we cannot pre-compute the weights, as the set of activeSubCluster // changes dynamically (and this would unfairly spread the load to // sub-clusters adjacent to an inactive one), hence we need to count/scan // the list and based on weight pick the next sub-cluster. Map<SubClusterIdInfo, Float> weights = - getPolicyInfo().getRouterPolicyWeights(); + getPolicyInfo().getRouterPolicyWeights(); ArrayList<Float> weightList = new ArrayList<>(); ArrayList<SubClusterId> scIdList = new ArrayList<>(); for (Map.Entry<SubClusterIdInfo, Float> entry : weights.entrySet()) { - if (blacklist != null && blacklist.contains(entry.getKey().toId())) { - continue; - } - if (entry.getKey() != null - && activeSubclusters.containsKey(entry.getKey().toId())) { + if (entry.getKey() != null && preSelectSubClusters.containsKey(entry.getKey().toId())) { Review Comment: Thank you for your suggestion. -- 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: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org