YARN-5876. TestResourceTrackerService#testGracefulDecommissionWithApp fails intermittently on trunk. (Robert Kanter via Yufei Gu)
This commit is contained in:
parent
abdea26280
commit
0b77262890
|
@ -120,7 +120,7 @@ public class MockRM extends ResourceManager {
|
||||||
private static final int SECOND = 1000;
|
private static final int SECOND = 1000;
|
||||||
private static final int TIMEOUT_MS_FOR_ATTEMPT = 40 * SECOND;
|
private static final int TIMEOUT_MS_FOR_ATTEMPT = 40 * SECOND;
|
||||||
private static final int TIMEOUT_MS_FOR_APP_REMOVED = 40 * SECOND;
|
private static final int TIMEOUT_MS_FOR_APP_REMOVED = 40 * SECOND;
|
||||||
private static final int TIMEOUT_MS_FOR_CONTAINER_AND_NODE = 10 * SECOND;
|
private static final int TIMEOUT_MS_FOR_CONTAINER_AND_NODE = 20 * SECOND;
|
||||||
private static final int WAIT_MS_PER_LOOP = 10;
|
private static final int WAIT_MS_PER_LOOP = 10;
|
||||||
|
|
||||||
private final boolean useNullRMNodeLabelsManager;
|
private final boolean useNullRMNodeLabelsManager;
|
||||||
|
@ -853,9 +853,17 @@ public class MockRM extends ResourceManager {
|
||||||
drainEventsImplicitly();
|
drainEventsImplicitly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RMNode getRMNode(NodeId nodeId) {
|
||||||
|
RMNode node = getRMContext().getRMNodes().get(nodeId);
|
||||||
|
if (node == null) {
|
||||||
|
node = getRMContext().getInactiveRMNodes().get(nodeId);
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until a node has reached a specified state.
|
* Wait until a node has reached a specified state.
|
||||||
* The timeout is 10 seconds.
|
* The timeout is 20 seconds.
|
||||||
* @param nodeId the id of a node
|
* @param nodeId the id of a node
|
||||||
* @param finalState the node state waited
|
* @param finalState the node state waited
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
|
@ -864,12 +872,17 @@ public class MockRM extends ResourceManager {
|
||||||
public void waitForState(NodeId nodeId, NodeState finalState)
|
public void waitForState(NodeId nodeId, NodeState finalState)
|
||||||
throws InterruptedException {
|
throws InterruptedException {
|
||||||
drainEventsImplicitly();
|
drainEventsImplicitly();
|
||||||
RMNode node = getRMContext().getRMNodes().get(nodeId);
|
|
||||||
if (node == null) {
|
|
||||||
node = getRMContext().getInactiveRMNodes().get(nodeId);
|
|
||||||
}
|
|
||||||
Assert.assertNotNull("node shouldn't be null", node);
|
|
||||||
int timeWaiting = 0;
|
int timeWaiting = 0;
|
||||||
|
RMNode node = getRMNode(nodeId);
|
||||||
|
while (node == null) {
|
||||||
|
if (timeWaiting >= TIMEOUT_MS_FOR_CONTAINER_AND_NODE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
node = getRMNode(nodeId);
|
||||||
|
Thread.sleep(WAIT_MS_PER_LOOP);
|
||||||
|
timeWaiting += WAIT_MS_PER_LOOP;
|
||||||
|
}
|
||||||
|
Assert.assertNotNull("node shouldn't be null (timedout)", node);
|
||||||
while (!finalState.equals(node.getState())) {
|
while (!finalState.equals(node.getState())) {
|
||||||
if (timeWaiting >= TIMEOUT_MS_FOR_CONTAINER_AND_NODE) {
|
if (timeWaiting >= TIMEOUT_MS_FOR_CONTAINER_AND_NODE) {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue