|
22 | 22 | import java.util.Map; |
23 | 23 | import java.util.Random; |
24 | 24 |
|
25 | | -import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; |
26 | 25 | import org.apache.hadoop.yarn.exceptions.YarnException; |
27 | 26 | import org.apache.hadoop.yarn.server.federation.policies.FederationPolicyInitializationContext; |
28 | 27 | import org.apache.hadoop.yarn.server.federation.policies.FederationPolicyInitializationContextValidator; |
29 | | -import org.apache.hadoop.yarn.server.federation.policies.FederationPolicyUtils; |
30 | 28 | import org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyException; |
31 | 29 | import org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyInitializationException; |
32 | 30 | import org.apache.hadoop.yarn.server.federation.store.records.SubClusterId; |
@@ -56,17 +54,16 @@ public void reinitialize(FederationPolicyInitializationContext policyContext) |
56 | 54 | this.getClass().getCanonicalName()); |
57 | 55 |
|
58 | 56 | // note: this overrides AbstractRouterPolicy and ignores the weights |
59 | | - |
60 | 57 | setPolicyContext(policyContext); |
61 | 58 | } |
62 | 59 |
|
63 | 60 | @Override |
64 | 61 | protected SubClusterId chooseSubCluster( |
65 | | - String queue, Map<SubClusterId, SubClusterInfo> preSelectSubClusters) throws YarnException { |
66 | | - if (preSelectSubClusters == null || preSelectSubClusters.isEmpty()) { |
67 | | - throw new FederationPolicyException("No available sub-cluster to choose from."); |
| 62 | + String queue, Map<SubClusterId, SubClusterInfo> preSelectSubclusters) throws YarnException { |
| 63 | + if (preSelectSubclusters == null || preSelectSubclusters.isEmpty()) { |
| 64 | + throw new FederationPolicyException("No available subcluster to choose from."); |
68 | 65 | } |
69 | | - List<SubClusterId> list = new ArrayList<>(preSelectSubClusters.keySet()); |
| 66 | + List<SubClusterId> list = new ArrayList<>(preSelectSubclusters.keySet()); |
70 | 67 | return list.get(rand.nextInt(list.size())); |
71 | 68 | } |
72 | 69 | } |
0 commit comments