Skip to content

Commit 5412975

Browse files
author
slfan1989
committed
YARN-11235. Fix CheckStyle.
1 parent 63c3696 commit 5412975

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/RouterPolicyFacade.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,12 @@ private FederationRouterPolicy getFederationRouterPolicy(
272272
try {
273273
configuration = federationFacade.getPolicyConfiguration(copyQueue);
274274
} catch (YarnException e) {
275-
LOG.warn("There is no policy configured for the queue: {}, " +
276-
"falling back to defaults.", copyQueue, e);
275+
LOG.warn("There is no policy configured for the queue: {}, falling back to defaults.",
276+
copyQueue, e);
277277
}
278278

279279
// If there is no policy configured for this queue, fallback to the baseline
280-
// policy that is configured either in the store or via XML config (and
281-
// cached)
280+
// policy that is configured either in the store or via XML config (and cached)
282281
if (configuration == null) {
283282
final String policyKey = YarnConfiguration.DEFAULT_FEDERATION_POLICY_KEY;
284283
LOG.warn("There is no policies configured for queue: {} " +
@@ -287,8 +286,8 @@ private FederationRouterPolicy getFederationRouterPolicy(
287286
try {
288287
configuration = federationFacade.getPolicyConfiguration(copyQueue);
289288
} catch (YarnException e) {
290-
LOG.warn("Cannot retrieve policy configured for the queue: {}, " +
291-
"falling back to defaults.", copyQueue, e);
289+
LOG.warn("Cannot retrieve policy configured for the queue: {}, falling back to defaults.",
290+
copyQueue, e);
292291
}
293292
}
294293

@@ -300,8 +299,9 @@ private FederationRouterPolicy getFederationRouterPolicy(
300299

301300
// if the configuration has changed since last loaded, reinit the policy
302301
// based on current configuration
303-
if (!cachedConfiguration.containsKey(copyQueue)
304-
|| !cachedConfiguration.get(copyQueue).equals(configuration)) {
302+
SubClusterPolicyConfiguration policyConfiguration =
303+
cachedConfiguration.getOrDefault(copyQueue, null);
304+
if (policyConfiguration == null || !policyConfiguration.equals(configuration)) {
305305
singlePolicyReinit(policyMap, cachedConfiguration, copyQueue, configuration);
306306
}
307307

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/router/LocalityRouterPolicy.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Map;
2424
import java.util.Collections;
2525

26-
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest;
2726
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
2827
import org.apache.hadoop.yarn.api.records.ExecutionType;
2928
import org.apache.hadoop.yarn.api.records.ExecutionTypeRequest;
@@ -133,14 +132,14 @@ public SubClusterId getHomeSubcluster(
133132
targetId = resolver.getSubClusterForNode(rr.getResourceName());
134133
nodeRequest = rr;
135134
} catch (YarnException e) {
136-
LOG.error("Cannot resolve node.");
135+
LOG.error("Cannot resolve node : {}.", rr.getResourceName(), e);
137136
}
138137
// Handle "rack" requests
139138
try {
140139
resolver.getSubClustersForRack(rr.getResourceName());
141140
rackRequest = rr;
142141
} catch (YarnException e) {
143-
LOG.error("Cannot resolve rack.");
142+
LOG.error("Cannot resolve rack : {}.", rr.getResourceName(), e);
144143
}
145144
// Handle "ANY" requests
146145
if (ResourceRequest.isAnyLocation(rr.getResourceName())) {
@@ -173,8 +172,8 @@ public SubClusterId getHomeSubcluster(
173172
+ " is in a blacklist SubCluster or not active. ");
174173
}
175174
} catch (YarnException e) {
176-
LOG.error("Validating resource requests failed, Falling back to "
177-
+ "WeightedRandomRouterPolicy placement.", e);
175+
LOG.error("Validating resource requests failed, " +
176+
"Falling back to WeightedRandomRouterPolicy placement.", e);
178177
// FailForward to WeightedRandomRouterPolicy
179178
// Overwrite request to use a default ANY
180179
ResourceRequest amReq = Records.newRecord(ResourceRequest.class);

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/router/PriorityRouterPolicy.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@
2727

2828
/**
2929
* This implements a policy that interprets "weights" as a ordered list of
30-
* preferences among sub-clusters. Highest weight among active subClusters is
30+
* preferences among sub-clusters. Highest weight among active subclusters is
3131
* chosen.
3232
*/
3333
public class PriorityRouterPolicy extends AbstractRouterPolicy {
3434

3535
@Override
3636
protected SubClusterId chooseSubCluster(
37-
String queue, Map<SubClusterId, SubClusterInfo> preSelectSubClusters) throws YarnException {
37+
String queue, Map<SubClusterId, SubClusterInfo> preSelectSubclusters) throws YarnException {
3838
// This finds the sub-cluster with the highest weight among the
3939
// currently active ones.
4040
Map<SubClusterIdInfo, Float> weights = getPolicyInfo().getRouterPolicyWeights();
4141
SubClusterId chosen = null;
4242
Float currentBest = Float.MIN_VALUE;
43-
for (SubClusterId id : preSelectSubClusters.keySet()) {
43+
for (SubClusterId id : preSelectSubclusters.keySet()) {
4444
SubClusterIdInfo idInfo = new SubClusterIdInfo(id);
4545
if (weights.containsKey(idInfo) && weights.get(idInfo) > currentBest) {
4646
currentBest = weights.get(idInfo);
@@ -49,7 +49,7 @@ protected SubClusterId chooseSubCluster(
4949
}
5050
if (chosen == null) {
5151
throw new FederationPolicyException(
52-
"No Active SubCluster with weight vector greater than zero.");
52+
"No Active Subcluster with weight vector greater than zero.");
5353
}
5454
return chosen;
5555
}

0 commit comments

Comments
 (0)