YARN-5377. Fix TestQueuingContainerManager.testKillMultipleOpportunisticContainers. (Konstantinos Karanasos via asuresh)
(cherry picked from commit f38a6d03a1
)
(cherry picked from commit 83ccab8a653a4ef943276651c9604bd434675980)
This commit is contained in:
parent
7437252102
commit
0e60c7cd33
|
@ -284,14 +284,16 @@ public abstract class BaseContainerManagerTest {
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void waitForContainerState(ContainerManagementProtocol containerManager,
|
public static void waitForContainerState(
|
||||||
ContainerId containerID, ContainerState finalState)
|
ContainerManagementProtocol containerManager, ContainerId containerID,
|
||||||
|
ContainerState finalState)
|
||||||
throws InterruptedException, YarnException, IOException {
|
throws InterruptedException, YarnException, IOException {
|
||||||
waitForContainerState(containerManager, containerID, finalState, 20);
|
waitForContainerState(containerManager, containerID, finalState, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void waitForContainerState(ContainerManagementProtocol containerManager,
|
public static void waitForContainerState(
|
||||||
ContainerId containerID, ContainerState finalState, int timeOutMax)
|
ContainerManagementProtocol containerManager, ContainerId containerID,
|
||||||
|
ContainerState finalState, int timeOutMax)
|
||||||
throws InterruptedException, YarnException, IOException {
|
throws InterruptedException, YarnException, IOException {
|
||||||
List<ContainerId> list = new ArrayList<ContainerId>();
|
List<ContainerId> list = new ArrayList<ContainerId>();
|
||||||
list.add(containerID);
|
list.add(containerID);
|
||||||
|
@ -314,8 +316,9 @@ public abstract class BaseContainerManagerTest {
|
||||||
finalState, containerStatus.getState());
|
finalState, containerStatus.getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void waitForApplicationState(ContainerManagerImpl containerManager,
|
public static void waitForApplicationState(
|
||||||
ApplicationId appID, ApplicationState finalState)
|
ContainerManagerImpl containerManager, ApplicationId appID,
|
||||||
|
ApplicationState finalState)
|
||||||
throws InterruptedException {
|
throws InterruptedException {
|
||||||
// Wait for app-finish
|
// Wait for app-finish
|
||||||
Application app =
|
Application app =
|
||||||
|
@ -346,6 +349,15 @@ public abstract class BaseContainerManagerTest {
|
||||||
org.apache.hadoop.yarn.server.nodemanager.containermanager
|
org.apache.hadoop.yarn.server.nodemanager.containermanager
|
||||||
.container.ContainerState finalState, int timeOutMax)
|
.container.ContainerState finalState, int timeOutMax)
|
||||||
throws InterruptedException, YarnException, IOException {
|
throws InterruptedException, YarnException, IOException {
|
||||||
|
waitForNMContainerState(containerManager, containerID,
|
||||||
|
Arrays.asList(finalState), timeOutMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void waitForNMContainerState(ContainerManagerImpl
|
||||||
|
containerManager, ContainerId containerID,
|
||||||
|
List<org.apache.hadoop.yarn.server.nodemanager.containermanager
|
||||||
|
.container.ContainerState> finalStates, int timeOutMax)
|
||||||
|
throws InterruptedException, YarnException, IOException {
|
||||||
Container container = null;
|
Container container = null;
|
||||||
org.apache.hadoop.yarn.server.nodemanager
|
org.apache.hadoop.yarn.server.nodemanager
|
||||||
.containermanager.container.ContainerState currentState = null;
|
.containermanager.container.ContainerState currentState = null;
|
||||||
|
@ -358,15 +370,15 @@ public abstract class BaseContainerManagerTest {
|
||||||
currentState = container.getContainerState();
|
currentState = container.getContainerState();
|
||||||
}
|
}
|
||||||
if (currentState != null) {
|
if (currentState != null) {
|
||||||
LOG.info("Waiting for NM container to get into state " + finalState
|
LOG.info("Waiting for NM container to get into one of the following " +
|
||||||
+ ". Current state is " + currentState);
|
"states: " + finalStates + ". Current state is " + currentState);
|
||||||
}
|
}
|
||||||
timeoutSecs += 2;
|
timeoutSecs += 2;
|
||||||
} while (!currentState.equals(finalState)
|
} while (!finalStates.contains(currentState)
|
||||||
&& timeoutSecs++ < timeOutMax);
|
&& timeoutSecs++ < timeOutMax);
|
||||||
LOG.info("Container state is " + currentState);
|
LOG.info("Container state is " + currentState);
|
||||||
Assert.assertEquals("ContainerState is not correct (timedout)",
|
Assert.assertTrue("ContainerState is not correct (timedout)",
|
||||||
finalState, currentState);
|
finalStates.contains(currentState));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Token createContainerToken(ContainerId cId, long rmIdentifier,
|
public static Token createContainerToken(ContainerId cId, long rmIdentifier,
|
||||||
|
|
|
@ -467,8 +467,10 @@ public class TestQueuingContainerManager extends BaseContainerManagerTest {
|
||||||
StartContainersRequest.newInstance(list);
|
StartContainersRequest.newInstance(list);
|
||||||
containerManager.startContainers(allRequests);
|
containerManager.startContainers(allRequests);
|
||||||
|
|
||||||
BaseContainerManagerTest.waitForNMContainerState(containerManager,
|
BaseContainerManagerTest.waitForNMContainerState(
|
||||||
createContainerId(0), ContainerState.DONE, 40);
|
containerManager, createContainerId(0),
|
||||||
|
Arrays.asList(ContainerState.DONE,
|
||||||
|
ContainerState.CONTAINER_CLEANEDUP_AFTER_KILL), 40);
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
|
|
||||||
// Get container statuses. Container 0 should be killed, container 1
|
// Get container statuses. Container 0 should be killed, container 1
|
||||||
|
|
Loading…
Reference in New Issue