YARN-343. Capacity Scheduler maximum-capacity value -1 is invalid (Xuan Gong via tgraves)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1440460 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c4e9838d53
commit
1456adb9e1
|
@ -260,6 +260,9 @@ Release 0.23.7 - UNRELEASED
|
|||
|
||||
BUG FIXES
|
||||
|
||||
YARN-343. Capacity Scheduler maximum-capacity value -1 is invalid (Xuan
|
||||
Gong via tgraves)
|
||||
|
||||
Release 0.23.6 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -99,6 +99,9 @@ public class CapacitySchedulerConfiguration extends Configuration {
|
|||
@Private
|
||||
public static final float MAXIMUM_CAPACITY_VALUE = 100;
|
||||
|
||||
@Private
|
||||
public static final float DEFAULT_MAXIMUM_CAPACITY_VALUE = -1.0f;
|
||||
|
||||
@Private
|
||||
public static final int DEFAULT_USER_LIMIT = 100;
|
||||
|
||||
|
@ -206,6 +209,8 @@ public class CapacitySchedulerConfiguration extends Configuration {
|
|||
public float getMaximumCapacity(String queue) {
|
||||
float maxCapacity = getFloat(getQueuePrefix(queue) + MAXIMUM_CAPACITY,
|
||||
MAXIMUM_CAPACITY_VALUE);
|
||||
maxCapacity = (maxCapacity == DEFAULT_MAXIMUM_CAPACITY_VALUE) ?
|
||||
MAXIMUM_CAPACITY_VALUE : maxCapacity;
|
||||
return maxCapacity;
|
||||
}
|
||||
|
||||
|
|
|
@ -243,6 +243,18 @@ public class TestCapacityScheduler {
|
|||
LOG.info("Setup top-level queues a and b");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMaximumCapacitySetup() {
|
||||
float delta = 0.0000001f;
|
||||
CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
|
||||
assertEquals(CapacitySchedulerConfiguration.MAXIMUM_CAPACITY_VALUE,conf.getMaximumCapacity(A),delta);
|
||||
conf.setMaximumCapacity(A, 50.0f);
|
||||
assertEquals(50.0f, conf.getMaximumCapacity(A),delta);
|
||||
conf.setMaximumCapacity(A, -1);
|
||||
assertEquals(CapacitySchedulerConfiguration.MAXIMUM_CAPACITY_VALUE,conf.getMaximumCapacity(A),delta);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRefreshQueues() throws Exception {
|
||||
CapacityScheduler cs = new CapacityScheduler();
|
||||
|
|
Loading…
Reference in New Issue