Skip to content

Commit

Permalink
YARN-11614. Fix CheckStyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
slfan1989 committed Nov 21, 2023
1 parent 1935515 commit 21a77e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import org.apache.hadoop.yarn.server.api.protocolrecords.DeleteFederationApplicationResponse;
import org.apache.hadoop.yarn.server.federation.failover.FederationProxyProviderUtil;
import org.apache.hadoop.yarn.server.federation.policies.manager.PriorityBroadcastPolicyManager;
import org.apache.hadoop.yarn.server.federation.policies.manager.WeightedHomePolicyManager;
import org.apache.hadoop.yarn.server.federation.policies.manager.WeightedLocalityPolicyManager;
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterId;
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterIdInfo;
Expand Down Expand Up @@ -121,8 +122,8 @@ public class FederationRMAdminInterceptor extends AbstractRMAdminRequestIntercep
private static final String COLON = ":";

private static final List<String> SUPPORT_WEIGHT_MANAGERS =
new ArrayList<>(Arrays.asList(WeightedLocalityPolicyManager.class.getSimpleName(),
PriorityBroadcastPolicyManager.class.getSimpleName()));
new ArrayList<>(Arrays.asList(WeightedLocalityPolicyManager.class.getName(),
PriorityBroadcastPolicyManager.class.getName(), WeightedHomePolicyManager.class.getName()));

private Map<SubClusterId, ResourceManagerAdministrationProtocol> adminRMProxies;
private FederationStateStoreFacade federationFacade;
Expand Down Expand Up @@ -937,7 +938,7 @@ public SaveFederationQueuePolicyResponse saveFederationQueuePolicy(
if (!checkPolicyManagerValid(policyManagerClassName, SUPPORT_WEIGHT_MANAGERS)) {
routerMetrics.incrSaveFederationQueuePolicyFailedRetrieved();
RouterServerUtil.logAndThrowException(policyManagerClassName +
"does not support the use of queue weights.", null);
" does not support the use of queue weights.", null);
}

String amRmWeight = federationQueueWeight.getAmrmWeight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,15 +643,25 @@ public void testSaveFederationQueuePolicyErrorRequest() throws Exception {
LambdaTestUtils.intercept(YarnException.class, "Missing Queue information.",
() -> interceptor.saveFederationQueuePolicy(request));

// routerWeight / amrmWeight
// The sum of the routerWeight is not equal to 1.
// PolicyManager needs to support weight
FederationQueueWeight federationQueueWeight2 = FederationQueueWeight.newInstance(
"SC-1:0.7,SC-2:0.3", "SC-1:0.8,SC-2:0.3", "1.0");
SaveFederationQueuePolicyRequest request2 =
SaveFederationQueuePolicyRequest.newInstance("root.a", federationQueueWeight2, "-");
SaveFederationQueuePolicyRequest.newInstance("root.a", federationQueueWeight2, "TestPolicyManager");
LambdaTestUtils.intercept(YarnException.class,
"The sum of ratios for all subClusters must be equal to 1.",
"TestPolicyManager does not support the use of queue weights.",
() -> interceptor.saveFederationQueuePolicy(request2));

// routerWeight / amrmWeight
// The sum of the routerWeight is not equal to 1.
String policyTypeName = WeightedLocalityPolicyManager.class.getCanonicalName();
FederationQueueWeight federationQueueWeight3 = FederationQueueWeight.newInstance(
"SC-1:0.7,SC-2:0.3", "SC-1:0.8,SC-2:0.3", "1.0");
SaveFederationQueuePolicyRequest request3 =
SaveFederationQueuePolicyRequest.newInstance("root.a", federationQueueWeight3, policyTypeName);
LambdaTestUtils.intercept(YarnException.class,
"The sum of ratios for all subClusters must be equal to 1.",
() -> interceptor.saveFederationQueuePolicy(request3));
}

@Test
Expand Down

0 comments on commit 21a77e9

Please sign in to comment.