YARN-9301. Too many InvalidStateTransitionException with SLS. Contributed by Bilwa S T.
(cherry picked from commit 9cbd0cd2a9
)
This commit is contained in:
parent
a1bebfd85e
commit
5be3a1dc7b
@ -82,36 +82,39 @@ private void setupAMRMToken(RMAppAttempt appAttempt) {
|
|||||||
@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
|
||||||
|
AMSimulator ams = appIdAMSim.get(appId);
|
||||||
|
if (ams == null) {
|
||||||
|
throw new YarnRuntimeException(
|
||||||
|
"Didn't find any AMSimulator for applicationId=" + appId);
|
||||||
|
}
|
||||||
|
Container amContainer = event.getAppAttempt().getMasterContainer();
|
||||||
|
switch (event.getType()) {
|
||||||
|
case LAUNCH:
|
||||||
|
try {
|
||||||
|
setupAMRMToken(event.getAppAttempt());
|
||||||
|
// Notify RMAppAttempt to change state
|
||||||
|
super.context.getDispatcher().getEventHandler().handle(
|
||||||
|
new RMAppAttemptEvent(event.getAppAttempt().getAppAttemptId(),
|
||||||
|
RMAppAttemptEventType.LAUNCHED));
|
||||||
|
|
||||||
// find AMSimulator
|
ams.notifyAMContainerLaunched(
|
||||||
AMSimulator ams = appIdAMSim.get(appId);
|
event.getAppAttempt().getMasterContainer());
|
||||||
if (ams != null) {
|
LOG.info("Notify AM launcher launched:" + amContainer.getId());
|
||||||
try {
|
|
||||||
Container amContainer = event.getAppAttempt().getMasterContainer();
|
|
||||||
|
|
||||||
setupAMRMToken(event.getAppAttempt());
|
se.getNmMap().get(amContainer.getNodeId())
|
||||||
|
.addNewContainer(amContainer, -1);
|
||||||
// Notify RMAppAttempt to change state
|
return;
|
||||||
super.context.getDispatcher().getEventHandler().handle(
|
} catch (Exception e) {
|
||||||
new RMAppAttemptEvent(event.getAppAttempt().getAppAttemptId(),
|
throw new YarnRuntimeException(e);
|
||||||
RMAppAttemptEventType.LAUNCHED));
|
|
||||||
|
|
||||||
ams.notifyAMContainerLaunched(
|
|
||||||
event.getAppAttempt().getMasterContainer());
|
|
||||||
LOG.info("Notify AM launcher launched:" + amContainer.getId());
|
|
||||||
|
|
||||||
se.getNmMap().get(amContainer.getNodeId())
|
|
||||||
.addNewContainer(amContainer, 100000000L);
|
|
||||||
|
|
||||||
return;
|
|
||||||
} catch (Exception 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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user