YARN-4890. Unit test intermittent failure: TestNodeLabelContainerAllocation#testQueueUsedCapacitiesUpdate. (Sunil G via wangda)
This commit is contained in:
parent
63ac2db59a
commit
33fd95a99c
|
@ -50,6 +50,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerAppRepor
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
|
||||||
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.FiCaSchedulerNode;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptRemovedSchedulerEvent;
|
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.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -1261,6 +1262,17 @@ public class TestNodeLabelContainerAllocation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void waitSchedulerNodeHasUpdatedLabels(CapacityScheduler cs,
|
||||||
|
MockNM nm, String partition) throws InterruptedException {
|
||||||
|
FiCaSchedulerNode node = cs.getNode(nm.getNodeId());
|
||||||
|
int totalWaitTick = 20; // wait 2 sec at most.
|
||||||
|
while (!node.getLabels().contains(partition)
|
||||||
|
&& totalWaitTick > 0) {
|
||||||
|
Thread.sleep(100);
|
||||||
|
totalWaitTick--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueueUsedCapacitiesUpdate()
|
public void testQueueUsedCapacitiesUpdate()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -1450,10 +1462,12 @@ public class TestNodeLabelContainerAllocation {
|
||||||
// Add nm3/nm4, double resource for both partitioned/non-partitioned
|
// Add nm3/nm4, double resource for both partitioned/non-partitioned
|
||||||
// resource, used capacity should be 1/2 of before
|
// resource, used capacity should be 1/2 of before
|
||||||
mgr.addLabelsToNode(ImmutableMap.of(NodeId.newInstance("h3", 0), toSet("x")));
|
mgr.addLabelsToNode(ImmutableMap.of(NodeId.newInstance("h3", 0), toSet("x")));
|
||||||
rm.registerNode("h3:1234", 10 * GB); // label = x
|
MockNM nm3 = rm.registerNode("h3:1234", 10 * GB); // label = x
|
||||||
rm.registerNode("h4:1234", 10 * GB); // label = <empty>
|
MockNM nm4 = rm.registerNode("h4:1234", 10 * GB); // label = <empty>
|
||||||
|
|
||||||
waitSchedulerNodeJoined(rm, 4);
|
waitSchedulerNodeJoined(rm, 4);
|
||||||
|
waitSchedulerNodeHasUpdatedLabels(cs, nm3, "x");
|
||||||
|
waitSchedulerNodeHasUpdatedLabels(cs, nm4, "");
|
||||||
|
|
||||||
checkQueueUsedCapacity("a", cs, "x", 0.3f, 0.15f);
|
checkQueueUsedCapacity("a", cs, "x", 0.3f, 0.15f);
|
||||||
checkQueueUsedCapacity("a", cs, "", 0.3f, 0.15f);
|
checkQueueUsedCapacity("a", cs, "", 0.3f, 0.15f);
|
||||||
|
|
Loading…
Reference in New Issue