Skip to content

Commit 21a77e9

Browse files
committed
YARN-11614. Fix CheckStyle.
1 parent 1935515 commit 21a77e9

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/rmadmin/FederationRMAdminInterceptor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
import org.apache.hadoop.yarn.server.api.protocolrecords.DeleteFederationApplicationResponse;
7777
import org.apache.hadoop.yarn.server.federation.failover.FederationProxyProviderUtil;
7878
import org.apache.hadoop.yarn.server.federation.policies.manager.PriorityBroadcastPolicyManager;
79+
import org.apache.hadoop.yarn.server.federation.policies.manager.WeightedHomePolicyManager;
7980
import org.apache.hadoop.yarn.server.federation.policies.manager.WeightedLocalityPolicyManager;
8081
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterId;
8182
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterIdInfo;
@@ -121,8 +122,8 @@ public class FederationRMAdminInterceptor extends AbstractRMAdminRequestIntercep
121122
private static final String COLON = ":";
122123

123124
private static final List<String> SUPPORT_WEIGHT_MANAGERS =
124-
new ArrayList<>(Arrays.asList(WeightedLocalityPolicyManager.class.getSimpleName(),
125-
PriorityBroadcastPolicyManager.class.getSimpleName()));
125+
new ArrayList<>(Arrays.asList(WeightedLocalityPolicyManager.class.getName(),
126+
PriorityBroadcastPolicyManager.class.getName(), WeightedHomePolicyManager.class.getName()));
126127

127128
private Map<SubClusterId, ResourceManagerAdministrationProtocol> adminRMProxies;
128129
private FederationStateStoreFacade federationFacade;
@@ -937,7 +938,7 @@ public SaveFederationQueuePolicyResponse saveFederationQueuePolicy(
937938
if (!checkPolicyManagerValid(policyManagerClassName, SUPPORT_WEIGHT_MANAGERS)) {
938939
routerMetrics.incrSaveFederationQueuePolicyFailedRetrieved();
939940
RouterServerUtil.logAndThrowException(policyManagerClassName +
940-
"does not support the use of queue weights.", null);
941+
" does not support the use of queue weights.", null);
941942
}
942943

943944
String amRmWeight = federationQueueWeight.getAmrmWeight();

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/rmadmin/TestFederationRMAdminInterceptor.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,15 +643,25 @@ public void testSaveFederationQueuePolicyErrorRequest() throws Exception {
643643
LambdaTestUtils.intercept(YarnException.class, "Missing Queue information.",
644644
() -> interceptor.saveFederationQueuePolicy(request));
645645

646-
// routerWeight / amrmWeight
647-
// The sum of the routerWeight is not equal to 1.
646+
// PolicyManager needs to support weight
648647
FederationQueueWeight federationQueueWeight2 = FederationQueueWeight.newInstance(
649648
"SC-1:0.7,SC-2:0.3", "SC-1:0.8,SC-2:0.3", "1.0");
650649
SaveFederationQueuePolicyRequest request2 =
651-
SaveFederationQueuePolicyRequest.newInstance("root.a", federationQueueWeight2, "-");
650+
SaveFederationQueuePolicyRequest.newInstance("root.a", federationQueueWeight2, "TestPolicyManager");
652651
LambdaTestUtils.intercept(YarnException.class,
653-
"The sum of ratios for all subClusters must be equal to 1.",
652+
"TestPolicyManager does not support the use of queue weights.",
654653
() -> interceptor.saveFederationQueuePolicy(request2));
654+
655+
// routerWeight / amrmWeight
656+
// The sum of the routerWeight is not equal to 1.
657+
String policyTypeName = WeightedLocalityPolicyManager.class.getCanonicalName();
658+
FederationQueueWeight federationQueueWeight3 = FederationQueueWeight.newInstance(
659+
"SC-1:0.7,SC-2:0.3", "SC-1:0.8,SC-2:0.3", "1.0");
660+
SaveFederationQueuePolicyRequest request3 =
661+
SaveFederationQueuePolicyRequest.newInstance("root.a", federationQueueWeight3, policyTypeName);
662+
LambdaTestUtils.intercept(YarnException.class,
663+
"The sum of ratios for all subClusters must be equal to 1.",
664+
() -> interceptor.saveFederationQueuePolicy(request3));
655665
}
656666

657667
@Test

0 commit comments

Comments
 (0)