YARN-9301. Too many InvalidStateTransitionException with SLS. Contributed by Bilwa S T.

(cherry picked from commit 9cbd0cd2a9)
This commit is contained in:
Inigo Goiri 2020-05-12 08:20:03 -07:00 committed by Brahma Reddy Battula
parent a1bebfd85e
commit 5be3a1dc7b
1 changed files with 30 additions and 27 deletions

View File

@ -82,18 +82,19 @@ public class MockAMLauncher extends ApplicationMasterLauncher
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void handle(AMLauncherEvent event) { public void handle(AMLauncherEvent event) {
if (AMLauncherEventType.LAUNCH == event.getType()) {
ApplicationId appId = ApplicationId appId =
event.getAppAttempt().getAppAttemptId().getApplicationId(); event.getAppAttempt().getAppAttemptId().getApplicationId();
// find AMSimulator // find AMSimulator
AMSimulator ams = appIdAMSim.get(appId); AMSimulator ams = appIdAMSim.get(appId);
if (ams != null) { if (ams == null) {
try { throw new YarnRuntimeException(
"Didn't find any AMSimulator for applicationId=" + appId);
}
Container amContainer = event.getAppAttempt().getMasterContainer(); Container amContainer = event.getAppAttempt().getMasterContainer();
switch (event.getType()) {
case LAUNCH:
try {
setupAMRMToken(event.getAppAttempt()); setupAMRMToken(event.getAppAttempt());
// Notify RMAppAttempt to change state // Notify RMAppAttempt to change state
super.context.getDispatcher().getEventHandler().handle( super.context.getDispatcher().getEventHandler().handle(
new RMAppAttemptEvent(event.getAppAttempt().getAppAttemptId(), new RMAppAttemptEvent(event.getAppAttempt().getAppAttemptId(),
@ -104,14 +105,16 @@ public class MockAMLauncher extends ApplicationMasterLauncher
LOG.info("Notify AM launcher launched:" + amContainer.getId()); LOG.info("Notify AM launcher launched:" + amContainer.getId());
se.getNmMap().get(amContainer.getNodeId()) se.getNmMap().get(amContainer.getNodeId())
.addNewContainer(amContainer, 100000000L); .addNewContainer(amContainer, -1);
return; return;
} catch (Exception e) { } catch (Exception e) {
throw new YarnRuntimeException(e); throw new YarnRuntimeException(e);
} }
} case CLEANUP:
se.getNmMap().get(amContainer.getNodeId())
.cleanupContainer(amContainer.getId());
break;
default:
throw new YarnRuntimeException( throw new YarnRuntimeException(
"Didn't find any AMSimulator for applicationId=" + appId); "Didn't find any AMSimulator for applicationId=" + appId);
} }