You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wa...@apache.org on 2016/06/07 19:42:38 UTC
[3/7] hadoop git commit: YARN-4844. Add
getMemorySize/getVirtualCoresSize to o.a.h.y.api.records.Resource. (wangda)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/19e57887/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java
index 383088a..9572bf5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java
@@ -324,7 +324,7 @@ public class TestLeafQueue {
a.assignContainers(clusterResource, node_0, new ResourceLimits(
clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
assertEquals(
- (int)(node_0.getTotalResource().getMemory() * a.getCapacity()) - (1*GB),
+ (int)(node_0.getTotalResource().getMemorySize() * a.getCapacity()) - (1*GB),
a.getMetrics().getAvailableMB());
}
@@ -406,7 +406,7 @@ public class TestLeafQueue {
assertEquals(1, a.getMetrics().getAppsSubmitted());
assertEquals(1, a.getMetrics().getAppsPending());
assertEquals(1, a.getUser(user_0).getActiveApplications());
- assertEquals(app_1.getAMResource().getMemory(), a.getMetrics()
+ assertEquals(app_1.getAMResource().getMemorySize(), a.getMetrics()
.getUsedAMResourceMB());
assertEquals(app_1.getAMResource().getVirtualCores(), a.getMetrics()
.getUsedAMResourceVCores());
@@ -514,9 +514,9 @@ public class TestLeafQueue {
// Only 1 container
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(1*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(1*GB, a.getMetrics().getAllocatedMB());
assertEquals(0*GB, a.getMetrics().getAvailableMB());
@@ -525,18 +525,18 @@ public class TestLeafQueue {
// you can get one container more than user-limit
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(2*GB, a.getMetrics().getAllocatedMB());
// Can't allocate 3rd due to user-limit
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(2*GB, a.getMetrics().getAllocatedMB());
@@ -544,18 +544,18 @@ public class TestLeafQueue {
a.setUserLimitFactor(10);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(3*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(3*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(3*GB, a.getMetrics().getAllocatedMB());
// One more should work, for app_1, due to user-limit-factor
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(4*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(4*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(4*GB, a.getMetrics().getAllocatedMB());
@@ -564,9 +564,9 @@ public class TestLeafQueue {
a.setMaxCapacity(0.5f);
a.assignContainers(clusterResource, node_0, new ResourceLimits(
clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(4*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(4*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(4*GB, a.getMetrics().getAllocatedMB());
@@ -578,9 +578,9 @@ public class TestLeafQueue {
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
RMContainerEventType.KILL, null, true);
}
- assertEquals(1*GB, a.getUsedResources().getMemory());
- assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, a.getUsedResources().getMemorySize());
+ assertEquals(0*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(1*GB, a.getMetrics().getAllocatedMB());
@@ -593,12 +593,12 @@ public class TestLeafQueue {
RMContainerEventType.KILL, null, true);
}
- assertEquals(0*GB, a.getUsedResources().getMemory());
- assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(0*GB, a.getUsedResources().getMemorySize());
+ assertEquals(0*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(0*GB, a.getMetrics().getAllocatedMB());
- assertEquals((int)(a.getCapacity() * node_0.getTotalResource().getMemory()),
+ assertEquals((int)(a.getCapacity() * node_0.getTotalResource().getMemorySize()),
a.getMetrics().getAvailableMB());
}
@@ -663,27 +663,27 @@ public class TestLeafQueue {
// 1 container to user_0
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(3*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(3*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// Allocate one container to app_1. Even if app_0
// submit earlier, it cannot get this container assigned since user_0
// exceeded user-limit already.
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(4*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(4*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
// Allocate one container to app_0, before allocating this container,
// user-limit = ceil((4 + 1) / 2) = 3G. app_0's used resource (3G) <=
// user-limit.
a.assignContainers(clusterResource, node_1,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(7*GB, a.getUsedResources().getMemory());
- assertEquals(6*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(7*GB, a.getUsedResources().getMemorySize());
+ assertEquals(6*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
// app_0 doesn't have outstanding resources, there's only one active user.
assertEquals("There should only be 1 active user!",
@@ -742,7 +742,7 @@ public class TestLeafQueue {
"", SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
//maxqueue 16G, userlimit 13G, - 4G used = 9G
- assertEquals(9*GB,app_0.getHeadroom().getMemory());
+ assertEquals(9*GB,app_0.getHeadroom().getMemorySize());
//test case 2
final ApplicationAttemptId appAttemptId_2 =
@@ -760,13 +760,13 @@ public class TestLeafQueue {
qb.computeUserLimitAndSetHeadroom(app_0, clusterResource,
"", SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(8*GB, qb.getUsedResources().getMemory());
- assertEquals(4*GB, app_0.getCurrentConsumption().getMemory());
+ assertEquals(8*GB, qb.getUsedResources().getMemorySize());
+ assertEquals(4*GB, app_0.getCurrentConsumption().getMemorySize());
//maxqueue 16G, userlimit 13G, - 4G used = 9G BUT
//maxqueue 16G - used 8G (4 each app/user) = 8G max headroom (the new logic)
- assertEquals(8*GB, app_0.getHeadroom().getMemory());
- assertEquals(4*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(8*GB, app_2.getHeadroom().getMemory());
+ assertEquals(8*GB, app_0.getHeadroom().getMemorySize());
+ assertEquals(4*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(8*GB, app_2.getHeadroom().getMemorySize());
//test case 3
qb.finishApplication(app_0.getApplicationId(), user_0);
@@ -803,10 +803,10 @@ public class TestLeafQueue {
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
qb.computeUserLimitAndSetHeadroom(app_3, clusterResource,
"", SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(4*GB, qb.getUsedResources().getMemory());
+ assertEquals(4*GB, qb.getUsedResources().getMemorySize());
//maxqueue 16G, userlimit 7G, used (by each user) 2G, headroom 5G (both)
- assertEquals(5*GB, app_3.getHeadroom().getMemory());
- assertEquals(5*GB, app_1.getHeadroom().getMemory());
+ assertEquals(5*GB, app_3.getHeadroom().getMemorySize());
+ assertEquals(5*GB, app_1.getHeadroom().getMemorySize());
//test case 4
final ApplicationAttemptId appAttemptId_4 =
TestUtils.getMockApplicationAttemptId(4, 0);
@@ -828,13 +828,13 @@ public class TestLeafQueue {
//app3 is user1, active from last test case
//maxqueue 16G, userlimit 13G, used 2G, would be headroom 10G BUT
//10G in use, so max possible headroom is 6G (new logic)
- assertEquals(6*GB, app_3.getHeadroom().getMemory());
+ assertEquals(6*GB, app_3.getHeadroom().getMemorySize());
//testcase3 still active - 2+2+6=10
- assertEquals(10*GB, qb.getUsedResources().getMemory());
+ assertEquals(10*GB, qb.getUsedResources().getMemorySize());
//app4 is user 0
//maxqueue 16G, userlimit 13G, used 8G, headroom 5G
//(8G used is 6G from this test case - app4, 2 from last test case, app_1)
- assertEquals(5*GB, app_4.getHeadroom().getMemory());
+ assertEquals(5*GB, app_4.getHeadroom().getMemorySize());
}
@Test
@@ -890,16 +890,16 @@ public class TestLeafQueue {
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(1*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
//Now, headroom is the same for all apps for a given user + queue combo
//and a change to any app's headroom is reflected for all the user's apps
//once those apps are active/have themselves calculated headroom for
//allocation at least one time
- assertEquals(2*GB, app_0.getHeadroom().getMemory());
- assertEquals(0*GB, app_1.getHeadroom().getMemory());//not yet active
- assertEquals(0*GB, app_2.getHeadroom().getMemory());//not yet active
+ assertEquals(2*GB, app_0.getHeadroom().getMemorySize());
+ assertEquals(0*GB, app_1.getHeadroom().getMemorySize());//not yet active
+ assertEquals(0*GB, app_2.getHeadroom().getMemorySize());//not yet active
app_1.updateResourceRequests(Collections.singletonList(
TestUtils.createResourceRequest(ResourceRequest.ANY, 1*GB, 2, true,
@@ -907,12 +907,12 @@ public class TestLeafQueue {
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_0.getHeadroom().getMemory());
- assertEquals(1*GB, app_1.getHeadroom().getMemory());//now active
- assertEquals(0*GB, app_2.getHeadroom().getMemory());//not yet active
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_0.getHeadroom().getMemorySize());
+ assertEquals(1*GB, app_1.getHeadroom().getMemorySize());//now active
+ assertEquals(0*GB, app_2.getHeadroom().getMemorySize());//not yet active
//Complete container and verify that headroom is updated, for both apps
//for the user
@@ -923,8 +923,8 @@ public class TestLeafQueue {
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
RMContainerEventType.KILL, null, true);
- assertEquals(2*GB, app_0.getHeadroom().getMemory());
- assertEquals(2*GB, app_1.getHeadroom().getMemory());
+ assertEquals(2*GB, app_0.getHeadroom().getMemorySize());
+ assertEquals(2*GB, app_1.getHeadroom().getMemorySize());
}
@Test
@@ -996,23 +996,23 @@ public class TestLeafQueue {
// 1 container to user_0
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// TODO, fix headroom in the future patch
- assertEquals(1*GB, app_0.getHeadroom().getMemory());
+ assertEquals(1*GB, app_0.getHeadroom().getMemorySize());
// User limit = 4G, 2 in use
- assertEquals(0*GB, app_1.getHeadroom().getMemory());
+ assertEquals(0*GB, app_1.getHeadroom().getMemorySize());
// the application is not yet active
// Again one to user_0 since he hasn't exceeded user limit yet
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(3*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_0.getHeadroom().getMemory()); // 4G - 3G
- assertEquals(1*GB, app_1.getHeadroom().getMemory()); // 4G - 3G
+ assertEquals(3*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_0.getHeadroom().getMemorySize()); // 4G - 3G
+ assertEquals(1*GB, app_1.getHeadroom().getMemorySize()); // 4G - 3G
// Submit requests for app_1 and set max-cap
a.setMaxCapacity(.1f);
@@ -1025,12 +1025,12 @@ public class TestLeafQueue {
// and no more containers to queue since it's already at max-cap
a.assignContainers(clusterResource, node_1,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(3*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_0.getHeadroom().getMemory());
- assertEquals(0*GB, app_1.getHeadroom().getMemory());
+ assertEquals(3*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_0.getHeadroom().getMemorySize());
+ assertEquals(0*GB, app_1.getHeadroom().getMemorySize());
// Check headroom for app_2
app_1.updateResourceRequests(Collections.singletonList( // unset
@@ -1039,7 +1039,7 @@ public class TestLeafQueue {
assertEquals(1, a.getActiveUsersManager().getNumActiveUsers());
a.assignContainers(clusterResource, node_1,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(0*GB, app_2.getHeadroom().getMemory()); // hit queue max-cap
+ assertEquals(0*GB, app_2.getHeadroom().getMemorySize()); // hit queue max-cap
}
@Test
@@ -1110,25 +1110,25 @@ public class TestLeafQueue {
// Only 1 container
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(1*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
// you can get one container more than user-limit
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// Can't allocate 3rd due to user-limit
a.setUserLimit(25);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// Submit resource requests for other apps now to 'activate' them
@@ -1145,32 +1145,32 @@ public class TestLeafQueue {
a.setUserLimitFactor(10);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(5*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(3*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(5*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(3*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
// Now allocations should goto app_0 since
// user_0 is at user-limit not above it
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(6*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(3*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(6*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(3*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
// Test max-capacity
// Now - no more allocs since we are at max-cap
a.setMaxCapacity(0.5f);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(6*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(3*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(6*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(3*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
// Revert max-capacity and user-limit-factor
// Now, allocations should goto app_3 since it's under user-limit
@@ -1178,20 +1178,20 @@ public class TestLeafQueue {
a.setUserLimitFactor(1);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(7*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(3*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(7*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(3*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_3.getCurrentConsumption().getMemorySize());
// Now we should assign to app_3 again since user_2 is under user-limit
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(8*GB, a.getUsedResources().getMemory());
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(3*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(2*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(8*GB, a.getUsedResources().getMemorySize());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(3*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(2*GB, app_3.getCurrentConsumption().getMemorySize());
// 8. Release each container from app_0
for (RMContainer rmContainer : app_0.getLiveContainers()) {
@@ -1201,11 +1201,11 @@ public class TestLeafQueue {
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
RMContainerEventType.KILL, null, true);
}
- assertEquals(5*GB, a.getUsedResources().getMemory());
- assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(3*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(2*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(5*GB, a.getUsedResources().getMemorySize());
+ assertEquals(0*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(3*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(2*GB, app_3.getCurrentConsumption().getMemorySize());
// 9. Release each container from app_2
for (RMContainer rmContainer : app_2.getLiveContainers()) {
@@ -1215,11 +1215,11 @@ public class TestLeafQueue {
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
RMContainerEventType.KILL, null, true);
}
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(2*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(0*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(2*GB, app_3.getCurrentConsumption().getMemorySize());
// 10. Release each container from app_3
for (RMContainer rmContainer : app_3.getLiveContainers()) {
@@ -1229,11 +1229,11 @@ public class TestLeafQueue {
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
RMContainerEventType.KILL, null, true);
}
- assertEquals(0*GB, a.getUsedResources().getMemory());
- assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(0*GB, a.getUsedResources().getMemorySize());
+ assertEquals(0*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
}
@Test
@@ -1287,9 +1287,9 @@ public class TestLeafQueue {
// Only 1 container
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(1*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1L*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1L*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(1*GB, a.getMetrics().getAllocatedMB());
assertEquals(0*GB, a.getMetrics().getAvailableMB());
@@ -1298,20 +1298,20 @@ public class TestLeafQueue {
// you can get one container more than user-limit
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(2*GB, a.getMetrics().getAllocatedMB());
// Now, reservation should kick in for app_1
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(6*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentReservation().getMemory());
- assertEquals(2*GB, node_0.getUsedResource().getMemory());
+ assertEquals(6*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentReservation().getMemorySize());
+ assertEquals(2*GB, node_0.getUsedResource().getMemorySize());
assertEquals(4*GB, a.getMetrics().getReservedMB());
assertEquals(2*GB, a.getMetrics().getAllocatedMB());
@@ -1324,11 +1324,12 @@ public class TestLeafQueue {
RMContainerEventType.KILL, null, true);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(5*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentReservation().getMemory());
- assertEquals(1*GB, node_0.getUsedResource().getMemory());
+
+ assertEquals(5*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentReservation().getMemorySize());
+ assertEquals(1*GB, node_0.getUsedResource().getMemorySize());
assertEquals(4*GB, a.getMetrics().getReservedMB());
assertEquals(1*GB, a.getMetrics().getAllocatedMB());
@@ -1341,11 +1342,11 @@ public class TestLeafQueue {
RMContainerEventType.KILL, null, true);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(4*GB, a.getUsedResources().getMemory());
- assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentReservation().getMemory());
- assertEquals(4*GB, node_0.getUsedResource().getMemory());
+ assertEquals(4*GB, a.getUsedResources().getMemorySize());
+ assertEquals(0*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentReservation().getMemorySize());
+ assertEquals(4*GB, node_0.getUsedResource().getMemorySize());
assertEquals(0*GB, a.getMetrics().getReservedMB());
assertEquals(4*GB, a.getMetrics().getAllocatedMB());
}
@@ -1415,26 +1416,26 @@ public class TestLeafQueue {
// Only 1 container
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(1*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
// you can get one container more than user-limit
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// Now, reservation should kick in for app_1
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(6*GB, a.getUsedResources().getMemory());
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentReservation().getMemory());
- assertEquals(2*GB, node_0.getUsedResource().getMemory());
+ assertEquals(6*GB, a.getUsedResources().getMemorySize());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentReservation().getMemorySize());
+ assertEquals(2*GB, node_0.getUsedResource().getMemorySize());
// Now free 1 container from app_0 i.e. 1G, and re-reserve it
RMContainer rmContainer = app_0.getLiveContainers().iterator().next();
@@ -1445,31 +1446,31 @@ public class TestLeafQueue {
RMContainerEventType.KILL, null, true);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(5*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentReservation().getMemory());
- assertEquals(1*GB, node_0.getUsedResource().getMemory());
+ assertEquals(5*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentReservation().getMemorySize());
+ assertEquals(1*GB, node_0.getUsedResource().getMemorySize());
assertEquals(1, app_1.getReReservations(priority));
// Re-reserve
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(5*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentReservation().getMemory());
- assertEquals(1*GB, node_0.getUsedResource().getMemory());
+ assertEquals(5*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentReservation().getMemorySize());
+ assertEquals(1*GB, node_0.getUsedResource().getMemorySize());
assertEquals(2, app_1.getReReservations(priority));
// Try to schedule on node_1 now, should *move* the reservation
a.assignContainers(clusterResource, node_1,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(9*GB, a.getUsedResources().getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentReservation().getMemory());
- assertEquals(4*GB, node_1.getUsedResource().getMemory());
+ assertEquals(9*GB, a.getUsedResources().getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentReservation().getMemorySize());
+ assertEquals(4*GB, node_1.getUsedResource().getMemorySize());
// Doesn't change yet... only when reservation is cancelled or a different
// container is reserved
assertEquals(2, app_1.getReReservations(priority));
@@ -1483,11 +1484,11 @@ public class TestLeafQueue {
RMContainerEventType.KILL, null, true);
a.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(4*GB, a.getUsedResources().getMemory());
- assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentReservation().getMemory());
- assertEquals(0*GB, node_0.getUsedResource().getMemory());
+ assertEquals(4*GB, a.getUsedResources().getMemorySize());
+ assertEquals(0*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(4*GB, app_1.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentReservation().getMemorySize());
+ assertEquals(0*GB, node_0.getUsedResource().getMemorySize());
}
private void verifyContainerAllocated(CSAssignment assignment, NodeType nodeType) {
@@ -2445,9 +2446,9 @@ public class TestLeafQueue {
// app_1 will get containers as it has high priority
a.assignContainers(clusterResource, node_0_0, new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- Assert.assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ Assert.assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
a.assignContainers(clusterResource, node_0_0, new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- Assert.assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
+ Assert.assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
app_0_requests_0.clear();
app_0_requests_0.add(
@@ -2463,12 +2464,12 @@ public class TestLeafQueue {
//app_1 will still get assigned first as priority is more.
a.assignContainers(clusterResource, node_0_0, new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- Assert.assertEquals(2*GB, app_1.getCurrentConsumption().getMemory());
- Assert.assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
+ Assert.assertEquals(2*GB, app_1.getCurrentConsumption().getMemorySize());
+ Assert.assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
//and only then will app_2
a.assignContainers(clusterResource, node_0_0, new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- Assert.assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
+ Assert.assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
}
@Test
public void testConcurrentAccess() throws Exception {
@@ -2592,9 +2593,9 @@ public class TestLeafQueue {
// app_0 will get containers as its submitted first.
a.assignContainers(clusterResource, node_0_0, new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- Assert.assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
+ Assert.assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
a.assignContainers(clusterResource, node_0_0, new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- Assert.assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ Assert.assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
app_0_requests_0.clear();
app_0_requests_0.add(
@@ -2611,12 +2612,12 @@ public class TestLeafQueue {
//Since it already has more resources, app_0 will not get
//assigned first, but app_1 will
a.assignContainers(clusterResource, node_0_0, new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- Assert.assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- Assert.assertEquals(2*GB, app_1.getCurrentConsumption().getMemory());
+ Assert.assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ Assert.assertEquals(2*GB, app_1.getCurrentConsumption().getMemorySize());
//and only then will app_0
a.assignContainers(clusterResource, node_0_0, new ResourceLimits(clusterResource), SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- Assert.assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
+ Assert.assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
}
@@ -2771,10 +2772,10 @@ public class TestLeafQueue {
// all users (only user_0) queue 'e' should be able to consume 1GB.
// The first container should be assigned to app_0 with no headroom left
// even though user_0's apps are still asking for a total of 4GB.
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// Assign 2nd container of 1GB
e.assignContainers(clusterResource, node_0,
@@ -2784,19 +2785,19 @@ public class TestLeafQueue {
// scheduler will assign one container more than user-limit-factor.
// This container also went to app_0. Still with no neadroom even though
// app_0 and app_1 are asking for a cumulative 3GB.
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// Can't allocate 3rd container due to user-limit. Headroom still 0.
e.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource),
SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// Increase user-limit-factor from 1GB to 10GB (1% * 10 * 100GB = 10GB).
// Pending for both app_0 and app_1 are still 3GB, so user-limit-factor
@@ -2804,16 +2805,16 @@ public class TestLeafQueue {
// getTotalPendingResourcesConsideringUserLimit()
e.setUserLimitFactor(10.0f);
assertEquals(3*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
e.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource),
SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
// app_0 is now satisified, app_1 is still asking for 2GB.
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(2*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// Get the last 2 containers for app_1, no more pending requests.
e.assignContainers(clusterResource, node_0,
@@ -2822,10 +2823,10 @@ public class TestLeafQueue {
e.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource),
SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
- assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(2*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(3*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(2*GB, app_1.getCurrentConsumption().getMemorySize());
assertEquals(0*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// Release each container from app_0
for (RMContainer rmContainer : app_0.getLiveContainers()) {
@@ -2927,14 +2928,14 @@ public class TestLeafQueue {
// With queue capacity set at 1% of 100GB and user-limit-factor set to 1.0,
// queue 'e' should be able to consume 1GB per user.
assertEquals(2*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// None of the apps have assigned resources
// user_0's apps:
- assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(0*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// user_1's apps:
- assertEquals(0*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(0*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
// Assign 1st Container of 1GB
e.assignContainers(clusterResource, node_0,
@@ -2943,13 +2944,13 @@ public class TestLeafQueue {
// The first container was assigned to user_0's app_0. Queues total headroom
// has 1GB left for user_1.
assertEquals(1*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// user_0's apps:
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_1.getCurrentConsumption().getMemorySize());
// user_1's apps:
- assertEquals(0*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(0*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
// Assign 2nd container of 1GB
e.assignContainers(clusterResource, node_0,
@@ -2960,13 +2961,13 @@ public class TestLeafQueue {
// this container went to user_0's app_1. so, headroom for queue 'e'e is
// still 1GB for user_1
assertEquals(1*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// user_0's apps:
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
// user_1's apps:
- assertEquals(0*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(0*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
// Assign 3rd container.
e.assignContainers(clusterResource, node_0,
@@ -2975,13 +2976,13 @@ public class TestLeafQueue {
// Container was allocated to user_1's app_2 since user_1, Now, no headroom
// is left.
assertEquals(0*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// user_0's apps:
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_1.getCurrentConsumption().getMemorySize());
// user_1's apps:
- assertEquals(1*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
// Assign 4th container.
e.assignContainers(clusterResource, node_0,
@@ -2990,16 +2991,16 @@ public class TestLeafQueue {
// Allocated to user_1's app_2 since scheduler allocates 1 container
// above user resource limit. Available headroom still 0.
assertEquals(0*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// user_0's apps:
- int app_0_consumption = app_0.getCurrentConsumption().getMemory();
+ long app_0_consumption = app_0.getCurrentConsumption().getMemorySize();
assertEquals(1*GB, app_0_consumption);
- int app_1_consumption = app_1.getCurrentConsumption().getMemory();
+ long app_1_consumption = app_1.getCurrentConsumption().getMemorySize();
assertEquals(1*GB, app_1_consumption);
// user_1's apps:
- int app_2_consumption = app_2.getCurrentConsumption().getMemory();
+ long app_2_consumption = app_2.getCurrentConsumption().getMemorySize();
assertEquals(2*GB, app_2_consumption);
- int app_3_consumption = app_3.getCurrentConsumption().getMemory();
+ long app_3_consumption = app_3.getCurrentConsumption().getMemorySize();
assertEquals(0*GB, app_3_consumption);
// Attempt to assign 5th container. Will be a no-op.
@@ -3009,13 +3010,13 @@ public class TestLeafQueue {
// Cannot allocate 5th container because both users are above their allowed
// user resource limit. Values should be the same as previously.
assertEquals(0*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// user_0's apps:
- assertEquals(app_0_consumption, app_0.getCurrentConsumption().getMemory());
- assertEquals(app_1_consumption, app_1.getCurrentConsumption().getMemory());
+ assertEquals(app_0_consumption, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(app_1_consumption, app_1.getCurrentConsumption().getMemorySize());
// user_1's apps:
- assertEquals(app_2_consumption, app_2.getCurrentConsumption().getMemory());
- assertEquals(app_3_consumption, app_3.getCurrentConsumption().getMemory());
+ assertEquals(app_2_consumption, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(app_3_consumption, app_3.getCurrentConsumption().getMemorySize());
// Increase user-limit-factor from 1GB to 10GB (1% * 10 * 100GB = 10GB).
// Pending for both user_0 and user_1 are still 1GB each, so user-limit-
@@ -3027,13 +3028,13 @@ public class TestLeafQueue {
SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);
// Next container goes to user_0's app_1, since it still wanted 1GB.
assertEquals(1*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
// user_0's apps:
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(2*GB, app_1.getCurrentConsumption().getMemory());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(2*GB, app_1.getCurrentConsumption().getMemorySize());
// user_1's apps:
- assertEquals(2*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(0*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(0*GB, app_3.getCurrentConsumption().getMemorySize());
e.assignContainers(clusterResource, node_0,
new ResourceLimits(clusterResource),
@@ -3041,12 +3042,12 @@ public class TestLeafQueue {
// Last container goes to user_1's app_3, since it still wanted 1GB.
// user_0's apps:
assertEquals(0*GB, e.getTotalPendingResourcesConsideringUserLimit(
- clusterResource, RMNodeLabelsManager.NO_LABEL).getMemory());
- assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
- assertEquals(2*GB, app_1.getCurrentConsumption().getMemory());
+ clusterResource, RMNodeLabelsManager.NO_LABEL).getMemorySize());
+ assertEquals(1*GB, app_0.getCurrentConsumption().getMemorySize());
+ assertEquals(2*GB, app_1.getCurrentConsumption().getMemorySize());
// user_1's apps:
- assertEquals(2*GB, app_2.getCurrentConsumption().getMemory());
- assertEquals(1*GB, app_3.getCurrentConsumption().getMemory());
+ assertEquals(2*GB, app_2.getCurrentConsumption().getMemorySize());
+ assertEquals(1*GB, app_3.getCurrentConsumption().getMemorySize());
// Release each container from app_0
for (RMContainer rmContainer : app_0.getLiveContainers()) {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/19e57887/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.java
index bbf6e43..626acd8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.java
@@ -461,7 +461,7 @@ public class TestNodeLabelContainerAllocation {
rm1.close();
}
-
+
private void checkPendingResource(MockRM rm, int priority,
ApplicationAttemptId attemptId, int memory) {
CapacityScheduler cs = (CapacityScheduler) rm.getRMContext().getScheduler();
@@ -470,7 +470,7 @@ public class TestNodeLabelContainerAllocation {
app.getAppSchedulingInfo().getResourceRequest(
Priority.newInstance(priority), "*");
Assert.assertEquals(memory,
- rr.getCapability().getMemory() * rr.getNumContainers());
+ rr.getCapability().getMemorySize() * rr.getNumContainers());
}
private void checkLaunchedContainerNumOnNode(MockRM rm, NodeId nodeId,
http://git-wip-us.apache.org/repos/asf/hadoop/blob/19e57887/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestParentQueue.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestParentQueue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestParentQueue.java
index 4a815f5..e3c04f8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestParentQueue.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestParentQueue.java
@@ -172,14 +172,14 @@ public class TestParentQueue {
private float computeQueueAbsoluteUsedCapacity(CSQueue queue,
int expectedMemory, Resource clusterResource) {
return (
- ((float)expectedMemory / (float)clusterResource.getMemory())
+ ((float)expectedMemory / (float)clusterResource.getMemorySize())
);
}
private float computeQueueUsedCapacity(CSQueue queue,
int expectedMemory, Resource clusterResource) {
return (expectedMemory /
- (clusterResource.getMemory() * queue.getAbsoluteCapacity()));
+ (clusterResource.getMemorySize() * queue.getAbsoluteCapacity()));
}
final static float DELTA = 0.0001f;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/19e57887/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueCapacities.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueCapacities.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueCapacities.java
index 9d2fa15..afdc6fc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueCapacities.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueCapacities.java
@@ -115,7 +115,7 @@ public class TestQueueCapacities {
}
void check(int mem, int cpu, Resource res) {
- Assert.assertEquals(mem, res.getMemory());
+ Assert.assertEquals(mem, res.getMemorySize());
Assert.assertEquals(cpu, res.getVirtualCores());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org