YARN-2643. Don't create a new DominantResourceCalculator on every FairScheduler.allocate call. (kasha via rkanter)

This commit is contained in:
Robert Kanter 2015-01-12 17:51:00 -08:00
parent 6f3a63a41b
commit 51881535e6
2 changed files with 8 additions and 2 deletions

View File

@ -180,6 +180,9 @@ Release 2.7.0 - UNRELEASED
YARN-2957. Create unit test to automatically compare YarnConfiguration
and yarn-default.xml. (rchiang via rkanter)
YARN-2643. Don't create a new DominantResourceCalculator on every
FairScheduler.allocate call. (kasha via rkanter)
OPTIMIZATIONS
BUG FIXES

View File

@ -127,6 +127,8 @@ public class FairScheduler extends
private static final ResourceCalculator RESOURCE_CALCULATOR =
new DefaultResourceCalculator();
private static final ResourceCalculator DOMINANT_RESOURCE_CALCULATOR =
new DominantResourceCalculator();
// Value that container assignment methods return when a container is
// reserved
@ -878,7 +880,8 @@ private synchronized void removeNode(RMNode rmNode) {
@Override
public Allocation allocate(ApplicationAttemptId appAttemptId,
List<ResourceRequest> ask, List<ContainerId> release, List<String> blacklistAdditions, List<String> blacklistRemovals) {
List<ResourceRequest> ask, List<ContainerId> release,
List<String> blacklistAdditions, List<String> blacklistRemovals) {
// Make sure this application exists
FSAppAttempt application = getSchedulerApp(appAttemptId);
@ -889,7 +892,7 @@ public Allocation allocate(ApplicationAttemptId appAttemptId,
}
// Sanity check
SchedulerUtils.normalizeRequests(ask, new DominantResourceCalculator(),
SchedulerUtils.normalizeRequests(ask, DOMINANT_RESOURCE_CALCULATOR,
clusterResource, minimumAllocation, getMaximumResourceCapability(),
incrAllocation);