YARN-3533. Test: Fix launchAM in MockRM to wait for attempt to be scheduled. Contributed by Anubhav Dhoot

(cherry picked from commit 4c1af156ae)
This commit is contained in:
Jian He 2015-04-29 14:50:01 -07:00
parent 2e13183f60
commit a7a5737bc4
2 changed files with 10 additions and 1 deletions

View File

@ -223,6 +223,9 @@ Release 2.8.0 - UNRELEASED
YARN-3517. RM web ui for dumping scheduler logs should be for admins only
(Varun Vasudev via tgraves)
YARN-3533. Test: Fix launchAM in MockRM to wait for attempt to be scheduled.
(Anubhav Dhoot via jianhe)
Release 2.7.1 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -164,6 +164,8 @@ public class MockRM extends ResourceManager {
nm.nodeHeartbeat(true);
Thread.sleep(200);
}
Assert.assertNotNull("Failed in waiting for " + containerId + " " +
"allocation.", getResourceScheduler().getRMContainer(containerId));
}
public void waitForContainerToComplete(RMAppAttempt attempt,
@ -677,6 +679,9 @@ public class MockRM extends ResourceManager {
}
tick++;
}
Assert.assertNotNull("Timed out waiting for SchedulerApplicationAttempt=" +
attemptId + " to be added.", ((AbstractYarnScheduler)
rm.getResourceScheduler()).getApplicationAttempt(attemptId));
}
public static MockAM launchAM(RMApp app, MockRM rm, MockNM nm)
@ -684,6 +689,7 @@ public class MockRM extends ResourceManager {
rm.waitForState(app.getApplicationId(), RMAppState.ACCEPTED);
RMAppAttempt attempt = app.getCurrentAppAttempt();
waitForSchedulerAppAttemptAdded(attempt.getAppAttemptId(), rm);
rm.waitForState(attempt.getAppAttemptId(), RMAppAttemptState.SCHEDULED);
System.out.println("Launch AM " + attempt.getAppAttemptId());
nm.nodeHeartbeat(true);
MockAM am = rm.sendAMLaunched(attempt.getAppAttemptId());