YARN-7748. TestContainerResizing.testIncreaseContainerUnreservedWhenApplicationCompleted fails due to multiple container fail events. Contributed by Weiwei Yang.

This commit is contained in:
Sunil G 2018-07-24 22:20:06 +05:30
parent 773d312f74
commit 35ce6eb1f5
1 changed files with 13 additions and 5 deletions

View File

@ -45,6 +45,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.NullRMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.NullRMNodeLabelsManager;
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEvent;
@ -58,7 +59,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica
.FiCaSchedulerNode; .FiCaSchedulerNode;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptRemovedSchedulerEvent;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.CandidateNodeSet; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.CandidateNodeSet;
import org.apache.hadoop.yarn.util.resource.Resources; import org.apache.hadoop.yarn.util.resource.Resources;
@ -740,11 +740,14 @@ public class TestContainerResizing {
@Test @Test
public void testIncreaseContainerUnreservedWhenApplicationCompleted() public void testIncreaseContainerUnreservedWhenApplicationCompleted()
throws Exception { throws Exception {
// Disable relaunch app attempt on failure, in order to check
// resource usages for current app only.
conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 1);
/** /**
* Similar to testIncreaseContainerUnreservedWhenContainerCompleted, when * Similar to testIncreaseContainerUnreservedWhenContainerCompleted, when
* application finishes, reserved increase container should be cancelled * application finishes, reserved increase container should be cancelled
*/ */
MockRM rm1 = new MockRM() { MockRM rm1 = new MockRM(conf) {
@Override @Override
public RMNodeLabelsManager createNodeLabelManager() { public RMNodeLabelsManager createNodeLabelManager() {
return mgr; return mgr;
@ -807,9 +810,14 @@ public class TestContainerResizing {
Assert.assertEquals(6 * GB, Assert.assertEquals(6 * GB,
app.getAppAttemptResourceUsage().getReserved().getMemorySize()); app.getAppAttemptResourceUsage().getReserved().getMemorySize());
// Kill the application // Kill the application by killing the AM container
cs.handle(new AppAttemptRemovedSchedulerEvent(am1.getApplicationAttemptId(), ContainerId amContainer =
RMAppAttemptState.KILLED, false)); ContainerId.newContainerId(am1.getApplicationAttemptId(), 1);
cs.killContainer(cs.getRMContainer(amContainer));
rm1.waitForState(am1.getApplicationAttemptId(),
RMAppAttemptState.FAILED);
rm1.waitForState(am1.getApplicationAttemptId().getApplicationId(),
RMAppState.FAILED);
/* Check statuses after reservation satisfied */ /* Check statuses after reservation satisfied */
// Increase request should be unreserved // Increase request should be unreserved