YARN-4556. TestFifoScheduler.testResourceOverCommit fails. Contributed by Akihiro Suda
This commit is contained in:
parent
08b7efa952
commit
3dce486d88
|
@ -813,6 +813,7 @@ public class TestCapacityScheduler {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testResourceOverCommit() throws Exception {
|
public void testResourceOverCommit() throws Exception {
|
||||||
|
int waitCount;
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
|
conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
|
||||||
ResourceScheduler.class);
|
ResourceScheduler.class);
|
||||||
|
@ -868,8 +869,17 @@ public class TestCapacityScheduler {
|
||||||
AdminService as = ((MockRM)rm).getAdminService();
|
AdminService as = ((MockRM)rm).getAdminService();
|
||||||
as.updateNodeResource(request);
|
as.updateNodeResource(request);
|
||||||
|
|
||||||
// Now, the used resource is still 4 GB, and available resource is minus value.
|
waitCount = 0;
|
||||||
|
while (waitCount++ != 20) {
|
||||||
report_nm1 = rm.getResourceScheduler().getNodeReport(nm1.getNodeId());
|
report_nm1 = rm.getResourceScheduler().getNodeReport(nm1.getNodeId());
|
||||||
|
if (report_nm1.getAvailableResource().getMemory() != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
LOG.info("Waiting for RMNodeResourceUpdateEvent to be handled... Tried "
|
||||||
|
+ waitCount + " times already..");
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
|
// Now, the used resource is still 4 GB, and available resource is minus value.
|
||||||
Assert.assertEquals(4 * GB, report_nm1.getUsedResource().getMemory());
|
Assert.assertEquals(4 * GB, report_nm1.getUsedResource().getMemory());
|
||||||
Assert.assertEquals(-2 * GB, report_nm1.getAvailableResource().getMemory());
|
Assert.assertEquals(-2 * GB, report_nm1.getAvailableResource().getMemory());
|
||||||
|
|
||||||
|
@ -877,7 +887,7 @@ public class TestCapacityScheduler {
|
||||||
ContainerStatus containerStatus = BuilderUtils.newContainerStatus(
|
ContainerStatus containerStatus = BuilderUtils.newContainerStatus(
|
||||||
c1.getId(), ContainerState.COMPLETE, "", 0, c1.getResource());
|
c1.getId(), ContainerState.COMPLETE, "", 0, c1.getResource());
|
||||||
nm1.containerStatus(containerStatus);
|
nm1.containerStatus(containerStatus);
|
||||||
int waitCount = 0;
|
waitCount = 0;
|
||||||
while (attempt1.getJustFinishedContainers().size() < 1
|
while (attempt1.getJustFinishedContainers().size() < 1
|
||||||
&& waitCount++ != 20) {
|
&& waitCount++ != 20) {
|
||||||
LOG.info("Waiting for containers to be finished for app 1... Tried "
|
LOG.info("Waiting for containers to be finished for app 1... Tried "
|
||||||
|
|
|
@ -1086,6 +1086,7 @@ public class TestFifoScheduler {
|
||||||
|
|
||||||
@Test(timeout = 60000)
|
@Test(timeout = 60000)
|
||||||
public void testResourceOverCommit() throws Exception {
|
public void testResourceOverCommit() throws Exception {
|
||||||
|
int waitCount;
|
||||||
MockRM rm = new MockRM(conf);
|
MockRM rm = new MockRM(conf);
|
||||||
rm.start();
|
rm.start();
|
||||||
|
|
||||||
|
@ -1138,9 +1139,18 @@ public class TestFifoScheduler {
|
||||||
UpdateNodeResourceRequest.newInstance(nodeResourceMap);
|
UpdateNodeResourceRequest.newInstance(nodeResourceMap);
|
||||||
rm.getAdminService().updateNodeResource(request);
|
rm.getAdminService().updateNodeResource(request);
|
||||||
|
|
||||||
|
waitCount = 0;
|
||||||
|
while (waitCount++ != 20) {
|
||||||
|
report_nm1 = rm.getResourceScheduler().getNodeReport(nm1.getNodeId());
|
||||||
|
if (report_nm1.getAvailableResource().getMemory() != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
LOG.info("Waiting for RMNodeResourceUpdateEvent to be handled... Tried "
|
||||||
|
+ waitCount + " times already..");
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
// Now, the used resource is still 4 GB, and available resource is minus
|
// Now, the used resource is still 4 GB, and available resource is minus
|
||||||
// value.
|
// value.
|
||||||
report_nm1 = rm.getResourceScheduler().getNodeReport(nm1.getNodeId());
|
|
||||||
Assert.assertEquals(4 * GB, report_nm1.getUsedResource().getMemory());
|
Assert.assertEquals(4 * GB, report_nm1.getUsedResource().getMemory());
|
||||||
Assert.assertEquals(-2 * GB, report_nm1.getAvailableResource().getMemory());
|
Assert.assertEquals(-2 * GB, report_nm1.getAvailableResource().getMemory());
|
||||||
|
|
||||||
|
@ -1150,7 +1160,7 @@ public class TestFifoScheduler {
|
||||||
BuilderUtils.newContainerStatus(c1.getId(), ContainerState.COMPLETE,
|
BuilderUtils.newContainerStatus(c1.getId(), ContainerState.COMPLETE,
|
||||||
"", 0, c1.getResource());
|
"", 0, c1.getResource());
|
||||||
nm1.containerStatus(containerStatus);
|
nm1.containerStatus(containerStatus);
|
||||||
int waitCount = 0;
|
waitCount = 0;
|
||||||
while (attempt1.getJustFinishedContainers().size() < 1 && waitCount++ != 20) {
|
while (attempt1.getJustFinishedContainers().size() < 1 && waitCount++ != 20) {
|
||||||
LOG.info("Waiting for containers to be finished for app 1... Tried "
|
LOG.info("Waiting for containers to be finished for app 1... Tried "
|
||||||
+ waitCount + " times already..");
|
+ waitCount + " times already..");
|
||||||
|
|
Loading…
Reference in New Issue