|
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertFalse;
|
|
import static org.junit.Assert.assertFalse;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.mockito.Matchers.any;
|
|
import static org.mockito.Matchers.any;
|
|
|
|
+import static org.mockito.Matchers.anyBoolean;
|
|
import static org.mockito.Matchers.eq;
|
|
import static org.mockito.Matchers.eq;
|
|
import static org.mockito.Mockito.doAnswer;
|
|
import static org.mockito.Mockito.doAnswer;
|
|
import static org.mockito.Mockito.doNothing;
|
|
import static org.mockito.Mockito.doNothing;
|
|
@@ -252,7 +253,7 @@ public class TestLeafQueue {
|
|
doNothing().when(parent).completedContainer(
|
|
doNothing().when(parent).completedContainer(
|
|
any(Resource.class), any(FiCaSchedulerApp.class), any(FiCaSchedulerNode.class),
|
|
any(Resource.class), any(FiCaSchedulerApp.class), any(FiCaSchedulerNode.class),
|
|
any(RMContainer.class), any(ContainerStatus.class),
|
|
any(RMContainer.class), any(ContainerStatus.class),
|
|
- any(RMContainerEventType.class), any(CSQueue.class));
|
|
|
|
|
|
+ any(RMContainerEventType.class), any(CSQueue.class), anyBoolean());
|
|
|
|
|
|
return queue;
|
|
return queue;
|
|
}
|
|
}
|
|
@@ -325,7 +326,7 @@ public class TestLeafQueue {
|
|
// Start testing...
|
|
// Start testing...
|
|
|
|
|
|
// Only 1 container
|
|
// Only 1 container
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(
|
|
assertEquals(
|
|
(int)(node_0.getTotalResource().getMemory() * a.getCapacity()) - (1*GB),
|
|
(int)(node_0.getTotalResource().getMemory() * a.getCapacity()) - (1*GB),
|
|
a.getMetrics().getAvailableMB());
|
|
a.getMetrics().getAvailableMB());
|
|
@@ -460,7 +461,7 @@ public class TestLeafQueue {
|
|
// Start testing...
|
|
// Start testing...
|
|
|
|
|
|
// Only 1 container
|
|
// Only 1 container
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -470,7 +471,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
|
|
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
|
|
// you can get one container more than user-limit
|
|
// you can get one container more than user-limit
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -478,7 +479,7 @@ public class TestLeafQueue {
|
|
assertEquals(2*GB, a.getMetrics().getAllocatedMB());
|
|
assertEquals(2*GB, a.getMetrics().getAllocatedMB());
|
|
|
|
|
|
// Can't allocate 3rd due to user-limit
|
|
// Can't allocate 3rd due to user-limit
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -487,7 +488,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// Bump up user-limit-factor, now allocate should work
|
|
// Bump up user-limit-factor, now allocate should work
|
|
a.setUserLimitFactor(10);
|
|
a.setUserLimitFactor(10);
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(3*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -495,7 +496,7 @@ public class TestLeafQueue {
|
|
assertEquals(3*GB, a.getMetrics().getAllocatedMB());
|
|
assertEquals(3*GB, a.getMetrics().getAllocatedMB());
|
|
|
|
|
|
// One more should work, for app_1, due to user-limit-factor
|
|
// One more should work, for app_1, due to user-limit-factor
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(4*GB, a.getUsedResources().getMemory());
|
|
assertEquals(4*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -505,7 +506,7 @@ public class TestLeafQueue {
|
|
// Test max-capacity
|
|
// Test max-capacity
|
|
// Now - no more allocs since we are at max-cap
|
|
// Now - no more allocs since we are at max-cap
|
|
a.setMaxCapacity(0.5f);
|
|
a.setMaxCapacity(0.5f);
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(4*GB, a.getUsedResources().getMemory());
|
|
assertEquals(4*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -518,7 +519,7 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
}
|
|
}
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
@@ -532,7 +533,7 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
}
|
|
}
|
|
|
|
|
|
assertEquals(0*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, a.getUsedResources().getMemory());
|
|
@@ -620,19 +621,19 @@ public class TestLeafQueue {
|
|
// recordFactory)));
|
|
// recordFactory)));
|
|
|
|
|
|
// 1 container to user_0
|
|
// 1 container to user_0
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
|
|
|
|
// Again one to user_0 since he hasn't exceeded user limit yet
|
|
// Again one to user_0 since he hasn't exceeded user limit yet
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(3*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
|
|
|
|
// One more to user_0 since he is the only active user
|
|
// One more to user_0 since he is the only active user
|
|
- a.assignContainers(clusterResource, node_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1, false);
|
|
assertEquals(4*GB, a.getUsedResources().getMemory());
|
|
assertEquals(4*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -705,7 +706,7 @@ public class TestLeafQueue {
|
|
1, a.getActiveUsersManager().getNumActiveUsers());
|
|
1, a.getActiveUsersManager().getNumActiveUsers());
|
|
|
|
|
|
// 1 container to user_0
|
|
// 1 container to user_0
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -713,7 +714,7 @@ public class TestLeafQueue {
|
|
assertEquals(0*GB, app_1.getHeadroom().getMemory()); // User limit = 2G
|
|
assertEquals(0*GB, app_1.getHeadroom().getMemory()); // User limit = 2G
|
|
|
|
|
|
// Again one to user_0 since he hasn't exceeded user limit yet
|
|
// Again one to user_0 since he hasn't exceeded user limit yet
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(3*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -729,7 +730,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// No more to user_0 since he is already over user-limit
|
|
// No more to user_0 since he is already over user-limit
|
|
// and no more containers to queue since it's already at max-cap
|
|
// and no more containers to queue since it's already at max-cap
|
|
- a.assignContainers(clusterResource, node_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1, false);
|
|
assertEquals(3*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -743,7 +744,7 @@ public class TestLeafQueue {
|
|
TestUtils.createResourceRequest(ResourceRequest.ANY, 1*GB, 0, true,
|
|
TestUtils.createResourceRequest(ResourceRequest.ANY, 1*GB, 0, true,
|
|
priority, recordFactory)));
|
|
priority, recordFactory)));
|
|
assertEquals(1, a.getActiveUsersManager().getNumActiveUsers());
|
|
assertEquals(1, a.getActiveUsersManager().getNumActiveUsers());
|
|
- a.assignContainers(clusterResource, node_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1, false);
|
|
assertEquals(1*GB, app_2.getHeadroom().getMemory()); // hit queue max-cap
|
|
assertEquals(1*GB, app_2.getHeadroom().getMemory()); // hit queue max-cap
|
|
}
|
|
}
|
|
|
|
|
|
@@ -813,21 +814,21 @@ public class TestLeafQueue {
|
|
*/
|
|
*/
|
|
|
|
|
|
// Only 1 container
|
|
// Only 1 container
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
|
|
|
|
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
|
|
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
|
|
// you can get one container more than user-limit
|
|
// you can get one container more than user-limit
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
|
|
|
|
// Can't allocate 3rd due to user-limit
|
|
// Can't allocate 3rd due to user-limit
|
|
a.setUserLimit(25);
|
|
a.setUserLimit(25);
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -845,7 +846,7 @@ public class TestLeafQueue {
|
|
// Now allocations should goto app_2 since
|
|
// Now allocations should goto app_2 since
|
|
// user_0 is at limit inspite of high user-limit-factor
|
|
// user_0 is at limit inspite of high user-limit-factor
|
|
a.setUserLimitFactor(10);
|
|
a.setUserLimitFactor(10);
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -854,7 +855,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// Now allocations should goto app_0 since
|
|
// Now allocations should goto app_0 since
|
|
// user_0 is at user-limit not above it
|
|
// user_0 is at user-limit not above it
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -864,7 +865,7 @@ public class TestLeafQueue {
|
|
// Test max-capacity
|
|
// Test max-capacity
|
|
// Now - no more allocs since we are at max-cap
|
|
// Now - no more allocs since we are at max-cap
|
|
a.setMaxCapacity(0.5f);
|
|
a.setMaxCapacity(0.5f);
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -875,7 +876,7 @@ public class TestLeafQueue {
|
|
// Now, allocations should goto app_3 since it's under user-limit
|
|
// Now, allocations should goto app_3 since it's under user-limit
|
|
a.setMaxCapacity(1.0f);
|
|
a.setMaxCapacity(1.0f);
|
|
a.setUserLimitFactor(1);
|
|
a.setUserLimitFactor(1);
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(7*GB, a.getUsedResources().getMemory());
|
|
assertEquals(7*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -883,7 +884,7 @@ public class TestLeafQueue {
|
|
assertEquals(1*GB, app_3.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_3.getCurrentConsumption().getMemory());
|
|
|
|
|
|
// Now we should assign to app_3 again since user_2 is under user-limit
|
|
// Now we should assign to app_3 again since user_2 is under user-limit
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(8*GB, a.getUsedResources().getMemory());
|
|
assertEquals(8*GB, a.getUsedResources().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(3*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -896,7 +897,7 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
}
|
|
}
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
@@ -910,7 +911,7 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
}
|
|
}
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
@@ -924,7 +925,7 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
}
|
|
}
|
|
assertEquals(0*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
@@ -982,7 +983,7 @@ public class TestLeafQueue {
|
|
// Start testing...
|
|
// Start testing...
|
|
|
|
|
|
// Only 1 container
|
|
// Only 1 container
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -992,7 +993,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
|
|
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
|
|
// you can get one container more than user-limit
|
|
// you can get one container more than user-limit
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1000,7 +1001,7 @@ public class TestLeafQueue {
|
|
assertEquals(2*GB, a.getMetrics().getAllocatedMB());
|
|
assertEquals(2*GB, a.getMetrics().getAllocatedMB());
|
|
|
|
|
|
// Now, reservation should kick in for app_1
|
|
// Now, reservation should kick in for app_1
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1015,8 +1016,8 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1031,8 +1032,8 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(4*GB, a.getUsedResources().getMemory());
|
|
assertEquals(4*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1099,7 +1100,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// Start testing...
|
|
// Start testing...
|
|
|
|
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1108,7 +1109,7 @@ public class TestLeafQueue {
|
|
assertEquals(0*GB, a.getMetrics().getAvailableMB());
|
|
assertEquals(0*GB, a.getMetrics().getAvailableMB());
|
|
|
|
|
|
// Now, reservation should kick in for app_1
|
|
// Now, reservation should kick in for app_1
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1121,7 +1122,7 @@ public class TestLeafQueue {
|
|
// We do not need locality delay here
|
|
// We do not need locality delay here
|
|
doReturn(-1).when(a).getNodeLocalityDelay();
|
|
doReturn(-1).when(a).getNodeLocalityDelay();
|
|
|
|
|
|
- a.assignContainers(clusterResource, node_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1, false);
|
|
assertEquals(10*GB, a.getUsedResources().getMemory());
|
|
assertEquals(10*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1136,8 +1137,8 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(8*GB, a.getUsedResources().getMemory());
|
|
assertEquals(8*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(8*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(8*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1205,20 +1206,20 @@ public class TestLeafQueue {
|
|
// Start testing...
|
|
// Start testing...
|
|
|
|
|
|
// Only 1 container
|
|
// Only 1 container
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
|
|
|
|
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
|
|
// Also 2nd -> minCapacity = 1024 since (.1 * 8G) < minAlloc, also
|
|
// you can get one container more than user-limit
|
|
// you can get one container more than user-limit
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
|
|
|
|
// Now, reservation should kick in for app_1
|
|
// Now, reservation should kick in for app_1
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(6*GB, a.getUsedResources().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(2*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1231,8 +1232,8 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1241,7 +1242,7 @@ public class TestLeafQueue {
|
|
assertEquals(1, app_1.getReReservations(priority));
|
|
assertEquals(1, app_1.getReReservations(priority));
|
|
|
|
|
|
// Re-reserve
|
|
// Re-reserve
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(5*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1250,7 +1251,7 @@ public class TestLeafQueue {
|
|
assertEquals(2, app_1.getReReservations(priority));
|
|
assertEquals(2, app_1.getReReservations(priority));
|
|
|
|
|
|
// Try to schedule on node_1 now, should *move* the reservation
|
|
// Try to schedule on node_1 now, should *move* the reservation
|
|
- a.assignContainers(clusterResource, node_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1, false);
|
|
assertEquals(9*GB, a.getUsedResources().getMemory());
|
|
assertEquals(9*GB, a.getUsedResources().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(1*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1266,8 +1267,8 @@ public class TestLeafQueue {
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerStatus.newInstance(rmContainer.getContainerId(),
|
|
ContainerState.COMPLETE, "",
|
|
ContainerState.COMPLETE, "",
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
ContainerExitStatus.KILLED_BY_RESOURCEMANAGER),
|
|
- RMContainerEventType.KILL, null);
|
|
|
|
- CSAssignment assignment = a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ RMContainerEventType.KILL, null, true);
|
|
|
|
+ CSAssignment assignment = a.assignContainers(clusterResource, node_0, false);
|
|
assertEquals(8*GB, a.getUsedResources().getMemory());
|
|
assertEquals(8*GB, a.getUsedResources().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(0*GB, app_0.getCurrentConsumption().getMemory());
|
|
assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
|
|
assertEquals(4*GB, app_1.getCurrentConsumption().getMemory());
|
|
@@ -1278,6 +1279,7 @@ public class TestLeafQueue {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void testLocalityScheduling() throws Exception {
|
|
public void testLocalityScheduling() throws Exception {
|
|
|
|
|
|
@@ -1337,7 +1339,7 @@ public class TestLeafQueue {
|
|
CSAssignment assignment = null;
|
|
CSAssignment assignment = null;
|
|
|
|
|
|
// Start with off switch, shouldn't allocate due to delay scheduling
|
|
// Start with off switch, shouldn't allocate due to delay scheduling
|
|
- assignment = a.assignContainers(clusterResource, node_2);
|
|
|
|
|
|
+ assignment = a.assignContainers(clusterResource, node_2, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(1, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(1, app_0.getSchedulingOpportunities(priority));
|
|
@@ -1345,7 +1347,7 @@ public class TestLeafQueue {
|
|
assertEquals(NodeType.NODE_LOCAL, assignment.getType()); // None->NODE_LOCAL
|
|
assertEquals(NodeType.NODE_LOCAL, assignment.getType()); // None->NODE_LOCAL
|
|
|
|
|
|
// Another off switch, shouldn't allocate due to delay scheduling
|
|
// Another off switch, shouldn't allocate due to delay scheduling
|
|
- assignment = a.assignContainers(clusterResource, node_2);
|
|
|
|
|
|
+ assignment = a.assignContainers(clusterResource, node_2, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(2, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(2, app_0.getSchedulingOpportunities(priority));
|
|
@@ -1353,7 +1355,7 @@ public class TestLeafQueue {
|
|
assertEquals(NodeType.NODE_LOCAL, assignment.getType()); // None->NODE_LOCAL
|
|
assertEquals(NodeType.NODE_LOCAL, assignment.getType()); // None->NODE_LOCAL
|
|
|
|
|
|
// Another off switch, shouldn't allocate due to delay scheduling
|
|
// Another off switch, shouldn't allocate due to delay scheduling
|
|
- assignment = a.assignContainers(clusterResource, node_2);
|
|
|
|
|
|
+ assignment = a.assignContainers(clusterResource, node_2, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(3, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(3, app_0.getSchedulingOpportunities(priority));
|
|
@@ -1362,7 +1364,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// Another off switch, now we should allocate
|
|
// Another off switch, now we should allocate
|
|
// since missedOpportunities=3 and reqdContainers=3
|
|
// since missedOpportunities=3 and reqdContainers=3
|
|
- assignment = a.assignContainers(clusterResource, node_2);
|
|
|
|
|
|
+ assignment = a.assignContainers(clusterResource, node_2, false);
|
|
verify(app_0).allocate(eq(NodeType.OFF_SWITCH), eq(node_2),
|
|
verify(app_0).allocate(eq(NodeType.OFF_SWITCH), eq(node_2),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(4, app_0.getSchedulingOpportunities(priority)); // should NOT reset
|
|
assertEquals(4, app_0.getSchedulingOpportunities(priority)); // should NOT reset
|
|
@@ -1370,7 +1372,7 @@ public class TestLeafQueue {
|
|
assertEquals(NodeType.OFF_SWITCH, assignment.getType());
|
|
assertEquals(NodeType.OFF_SWITCH, assignment.getType());
|
|
|
|
|
|
// NODE_LOCAL - node_0
|
|
// NODE_LOCAL - node_0
|
|
- assignment = a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ assignment = a.assignContainers(clusterResource, node_0, false);
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_0),
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_0),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
@@ -1378,7 +1380,7 @@ public class TestLeafQueue {
|
|
assertEquals(NodeType.NODE_LOCAL, assignment.getType());
|
|
assertEquals(NodeType.NODE_LOCAL, assignment.getType());
|
|
|
|
|
|
// NODE_LOCAL - node_1
|
|
// NODE_LOCAL - node_1
|
|
- assignment = a.assignContainers(clusterResource, node_1);
|
|
|
|
|
|
+ assignment = a.assignContainers(clusterResource, node_1, false);
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_1),
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_1),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
@@ -1406,13 +1408,13 @@ public class TestLeafQueue {
|
|
doReturn(1).when(a).getNodeLocalityDelay();
|
|
doReturn(1).when(a).getNodeLocalityDelay();
|
|
|
|
|
|
// Shouldn't assign RACK_LOCAL yet
|
|
// Shouldn't assign RACK_LOCAL yet
|
|
- assignment = a.assignContainers(clusterResource, node_3);
|
|
|
|
|
|
+ assignment = a.assignContainers(clusterResource, node_3, false);
|
|
assertEquals(1, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(1, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(2, app_0.getTotalRequiredResources(priority));
|
|
assertEquals(2, app_0.getTotalRequiredResources(priority));
|
|
assertEquals(NodeType.NODE_LOCAL, assignment.getType()); // None->NODE_LOCAL
|
|
assertEquals(NodeType.NODE_LOCAL, assignment.getType()); // None->NODE_LOCAL
|
|
|
|
|
|
// Should assign RACK_LOCAL now
|
|
// Should assign RACK_LOCAL now
|
|
- assignment = a.assignContainers(clusterResource, node_3);
|
|
|
|
|
|
+ assignment = a.assignContainers(clusterResource, node_3, false);
|
|
verify(app_0).allocate(eq(NodeType.RACK_LOCAL), eq(node_3),
|
|
verify(app_0).allocate(eq(NodeType.RACK_LOCAL), eq(node_3),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
@@ -1493,7 +1495,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// Start with off switch, shouldn't allocate P1 due to delay scheduling
|
|
// Start with off switch, shouldn't allocate P1 due to delay scheduling
|
|
// thus, no P2 either!
|
|
// thus, no P2 either!
|
|
- a.assignContainers(clusterResource, node_2);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_2, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(1, app_0.getSchedulingOpportunities(priority_1));
|
|
assertEquals(1, app_0.getSchedulingOpportunities(priority_1));
|
|
@@ -1505,7 +1507,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// Another off-switch, shouldn't allocate P1 due to delay scheduling
|
|
// Another off-switch, shouldn't allocate P1 due to delay scheduling
|
|
// thus, no P2 either!
|
|
// thus, no P2 either!
|
|
- a.assignContainers(clusterResource, node_2);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_2, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_2),
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(2, app_0.getSchedulingOpportunities(priority_1));
|
|
assertEquals(2, app_0.getSchedulingOpportunities(priority_1));
|
|
@@ -1516,7 +1518,7 @@ public class TestLeafQueue {
|
|
assertEquals(1, app_0.getTotalRequiredResources(priority_2));
|
|
assertEquals(1, app_0.getTotalRequiredResources(priority_2));
|
|
|
|
|
|
// Another off-switch, shouldn't allocate OFF_SWITCH P1
|
|
// Another off-switch, shouldn't allocate OFF_SWITCH P1
|
|
- a.assignContainers(clusterResource, node_2);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_2, false);
|
|
verify(app_0).allocate(eq(NodeType.OFF_SWITCH), eq(node_2),
|
|
verify(app_0).allocate(eq(NodeType.OFF_SWITCH), eq(node_2),
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(3, app_0.getSchedulingOpportunities(priority_1));
|
|
assertEquals(3, app_0.getSchedulingOpportunities(priority_1));
|
|
@@ -1527,7 +1529,7 @@ public class TestLeafQueue {
|
|
assertEquals(1, app_0.getTotalRequiredResources(priority_2));
|
|
assertEquals(1, app_0.getTotalRequiredResources(priority_2));
|
|
|
|
|
|
// Now, DATA_LOCAL for P1
|
|
// Now, DATA_LOCAL for P1
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_0),
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_0),
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority_1));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority_1));
|
|
@@ -1538,7 +1540,7 @@ public class TestLeafQueue {
|
|
assertEquals(1, app_0.getTotalRequiredResources(priority_2));
|
|
assertEquals(1, app_0.getTotalRequiredResources(priority_2));
|
|
|
|
|
|
// Now, OFF_SWITCH for P2
|
|
// Now, OFF_SWITCH for P2
|
|
- a.assignContainers(clusterResource, node_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1),
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
eq(priority_1), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority_1));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority_1));
|
|
@@ -1614,7 +1616,7 @@ public class TestLeafQueue {
|
|
app_0.updateResourceRequests(app_0_requests_0);
|
|
app_0.updateResourceRequests(app_0_requests_0);
|
|
|
|
|
|
// NODE_LOCAL - node_0_1
|
|
// NODE_LOCAL - node_0_1
|
|
- a.assignContainers(clusterResource, node_0_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0_0, false);
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_0_0),
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_0_0),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
@@ -1622,7 +1624,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// No allocation on node_1_0 even though it's node/rack local since
|
|
// No allocation on node_1_0 even though it's node/rack local since
|
|
// required(ANY) == 0
|
|
// required(ANY) == 0
|
|
- a.assignContainers(clusterResource, node_1_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1_0, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1_0),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1_0),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // Still zero
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // Still zero
|
|
@@ -1638,14 +1640,14 @@ public class TestLeafQueue {
|
|
|
|
|
|
// No allocation on node_0_1 even though it's node/rack local since
|
|
// No allocation on node_0_1 even though it's node/rack local since
|
|
// required(rack_1) == 0
|
|
// required(rack_1) == 0
|
|
- a.assignContainers(clusterResource, node_0_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0_1, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1_0),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1_0),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(1, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(1, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(1, app_0.getTotalRequiredResources(priority));
|
|
assertEquals(1, app_0.getTotalRequiredResources(priority));
|
|
|
|
|
|
// NODE_LOCAL - node_1
|
|
// NODE_LOCAL - node_1
|
|
- a.assignContainers(clusterResource, node_1_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1_0, false);
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_1_0),
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_1_0),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should reset
|
|
@@ -1889,7 +1891,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// node_0_1
|
|
// node_0_1
|
|
// Shouldn't allocate since RR(rack_0) = null && RR(ANY) = relax: false
|
|
// Shouldn't allocate since RR(rack_0) = null && RR(ANY) = relax: false
|
|
- a.assignContainers(clusterResource, node_0_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0_1, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_0_1),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_0_1),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should be 0
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should be 0
|
|
@@ -1911,7 +1913,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// node_1_1
|
|
// node_1_1
|
|
// Shouldn't allocate since RR(rack_1) = relax: false
|
|
// Shouldn't allocate since RR(rack_1) = relax: false
|
|
- a.assignContainers(clusterResource, node_1_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1_1, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_0_1),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_0_1),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should be 0
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should be 0
|
|
@@ -1941,7 +1943,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// node_1_1
|
|
// node_1_1
|
|
// Shouldn't allocate since node_1_1 is blacklisted
|
|
// Shouldn't allocate since node_1_1 is blacklisted
|
|
- a.assignContainers(clusterResource, node_1_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1_1, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1_1),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1_1),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should be 0
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should be 0
|
|
@@ -1969,7 +1971,7 @@ public class TestLeafQueue {
|
|
|
|
|
|
// node_1_1
|
|
// node_1_1
|
|
// Shouldn't allocate since rack_1 is blacklisted
|
|
// Shouldn't allocate since rack_1 is blacklisted
|
|
- a.assignContainers(clusterResource, node_1_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1_1, false);
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1_1),
|
|
verify(app_0, never()).allocate(any(NodeType.class), eq(node_1_1),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should be 0
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority)); // should be 0
|
|
@@ -1995,7 +1997,7 @@ public class TestLeafQueue {
|
|
// Blacklist: < host_0_0 > <----
|
|
// Blacklist: < host_0_0 > <----
|
|
|
|
|
|
// Now, should allocate since RR(rack_1) = relax: true
|
|
// Now, should allocate since RR(rack_1) = relax: true
|
|
- a.assignContainers(clusterResource, node_1_1);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1_1, false);
|
|
verify(app_0,never()).allocate(eq(NodeType.RACK_LOCAL), eq(node_1_1),
|
|
verify(app_0,never()).allocate(eq(NodeType.RACK_LOCAL), eq(node_1_1),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority));
|
|
@@ -2025,7 +2027,7 @@ public class TestLeafQueue {
|
|
// host_1_0: 8G
|
|
// host_1_0: 8G
|
|
// host_1_1: 7G
|
|
// host_1_1: 7G
|
|
|
|
|
|
- a.assignContainers(clusterResource, node_1_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_1_0, false);
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_1_0),
|
|
verify(app_0).allocate(eq(NodeType.NODE_LOCAL), eq(node_1_0),
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
any(Priority.class), any(ResourceRequest.class), any(Container.class));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority));
|
|
assertEquals(0, app_0.getSchedulingOpportunities(priority));
|
|
@@ -2105,7 +2107,7 @@ public class TestLeafQueue {
|
|
recordFactory)));
|
|
recordFactory)));
|
|
|
|
|
|
try {
|
|
try {
|
|
- a.assignContainers(clusterResource, node_0);
|
|
|
|
|
|
+ a.assignContainers(clusterResource, node_0, false);
|
|
} catch (NullPointerException e) {
|
|
} catch (NullPointerException e) {
|
|
Assert.fail("NPE when allocating container on node but "
|
|
Assert.fail("NPE when allocating container on node but "
|
|
+ "forget to set off-switch request should be handled");
|
|
+ "forget to set off-switch request should be handled");
|