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:
parent
2e13183f60
commit
a7a5737bc4
|
@ -223,6 +223,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
YARN-3517. RM web ui for dumping scheduler logs should be for admins only
|
YARN-3517. RM web ui for dumping scheduler logs should be for admins only
|
||||||
(Varun Vasudev via tgraves)
|
(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
|
Release 2.7.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -164,6 +164,8 @@ public class MockRM extends ResourceManager {
|
||||||
nm.nodeHeartbeat(true);
|
nm.nodeHeartbeat(true);
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
}
|
}
|
||||||
|
Assert.assertNotNull("Failed in waiting for " + containerId + " " +
|
||||||
|
"allocation.", getResourceScheduler().getRMContainer(containerId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitForContainerToComplete(RMAppAttempt attempt,
|
public void waitForContainerToComplete(RMAppAttempt attempt,
|
||||||
|
@ -662,7 +664,7 @@ public class MockRM extends ResourceManager {
|
||||||
am.waitForState(RMAppAttemptState.FINISHED);
|
am.waitForState(RMAppAttemptState.FINISHED);
|
||||||
rm.waitForState(rmApp.getApplicationId(), RMAppState.FINISHED);
|
rm.waitForState(rmApp.getApplicationId(), RMAppState.FINISHED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private static void waitForSchedulerAppAttemptAdded(
|
private static void waitForSchedulerAppAttemptAdded(
|
||||||
ApplicationAttemptId attemptId, MockRM rm) throws InterruptedException {
|
ApplicationAttemptId attemptId, MockRM rm) throws InterruptedException {
|
||||||
|
@ -677,6 +679,9 @@ public class MockRM extends ResourceManager {
|
||||||
}
|
}
|
||||||
tick++;
|
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)
|
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);
|
rm.waitForState(app.getApplicationId(), RMAppState.ACCEPTED);
|
||||||
RMAppAttempt attempt = app.getCurrentAppAttempt();
|
RMAppAttempt attempt = app.getCurrentAppAttempt();
|
||||||
waitForSchedulerAppAttemptAdded(attempt.getAppAttemptId(), rm);
|
waitForSchedulerAppAttemptAdded(attempt.getAppAttemptId(), rm);
|
||||||
|
rm.waitForState(attempt.getAppAttemptId(), RMAppAttemptState.SCHEDULED);
|
||||||
System.out.println("Launch AM " + attempt.getAppAttemptId());
|
System.out.println("Launch AM " + attempt.getAppAttemptId());
|
||||||
nm.nodeHeartbeat(true);
|
nm.nodeHeartbeat(true);
|
||||||
MockAM am = rm.sendAMLaunched(attempt.getAppAttemptId());
|
MockAM am = rm.sendAMLaunched(attempt.getAppAttemptId());
|
||||||
|
|
Loading…
Reference in New Issue