YARN-5815. Random failure of TestApplicationPriority.testOrderOfActivatingThePriorityApplicationOnRMRestart (Bibin A Chundatt via Varun Saxena)

This commit is contained in:
Varun Saxena 2016-11-03 00:41:53 +05:30
parent 35e6081020
commit b818773919
1 changed files with 11 additions and 12 deletions

View File

@ -684,36 +684,35 @@ public class TestApplicationPriority {
(LeafQueue) ((CapacityScheduler) scheduler).getQueue("default"); (LeafQueue) ((CapacityScheduler) scheduler).getQueue("default");
// wait for all applications to get added to scheduler // wait for all applications to get added to scheduler
int count = 5; int count = 50;
while (count-- > 0) { while (count-- > 0) {
if ((defaultQueue.getNumActiveApplications() + defaultQueue if (defaultQueue.getNumPendingApplications() == 3) {
.getNumPendingApplications()) == 3) {
break; break;
} }
Thread.sleep(500); Thread.sleep(50);
} }
// Before NM registration, AMResourceLimit threshold is 0. So no // Before NM registration, AMResourceLimit threshold is 0. So no
// applications get activated. // applications get activated.
Assert.assertEquals(0, defaultQueue.getNumActiveApplications()); Assert.assertEquals(0, defaultQueue.getNumActiveApplications());
Assert.assertEquals(3, defaultQueue.getNumPendingApplications());
// NM resync to new RM // NM resync to new RM
nm1.registerNode(); nm1.registerNode();
dispatcher1.await(); dispatcher1.await();
Assert.assertEquals(2, defaultQueue.getNumActiveApplications()); // wait for activating applications
Assert.assertEquals(1, defaultQueue.getNumPendingApplications()); count = 50;
// wait for activating one applications
count = 5;
while (count-- > 0) { while (count-- > 0) {
if (defaultQueue.getOrderingPolicy().getSchedulableEntities().size() == 2) { if (defaultQueue.getNumActiveApplications() == 2) {
break; break;
} }
Thread.sleep(500); Thread.sleep(50);
} }
Assert.assertEquals(2, defaultQueue.getNumActiveApplications());
Assert.assertEquals(1, defaultQueue.getNumPendingApplications());
// verify for order of activated applications iterator // verify for order of activated applications iterator
iterator = iterator =
defaultQueue.getOrderingPolicy().getSchedulableEntities().iterator(); defaultQueue.getOrderingPolicy().getSchedulableEntities().iterator();