YARN-345. Many InvalidStateTransitonException errors for ApplicationImpl in Node Manager. Contributed by Robert Parker

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1452548 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason Darrell Lowe 2013-03-04 21:47:39 +00:00
parent 9334dc23f9
commit 5889f54ad1
5 changed files with 35 additions and 7 deletions

View File

@ -365,6 +365,9 @@ Release 0.23.7 - UNRELEASED
YARN-448. Remove unnecessary hflush from log aggregation (Kihwal Lee via
bobby)
YARN-345. Many InvalidStateTransitonException errors for ApplicationImpl
in Node Manager (Robert Parker via jlowe)
Release 0.23.6 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -34,5 +34,6 @@ public enum ApplicationEventType {
// Source: Log Handler
APPLICATION_LOG_HANDLING_INITED,
APPLICATION_LOG_HANDLING_FINISHED
APPLICATION_LOG_HANDLING_FINISHED,
APPLICATION_LOG_HANDLING_FAILED
}

View File

@ -149,6 +149,9 @@ ApplicationEventType.INIT_APPLICATION, new AppInitTransition())
.addTransition(ApplicationState.INITING, ApplicationState.INITING,
ApplicationEventType.APPLICATION_LOG_HANDLING_INITED,
new AppLogInitDoneTransition())
.addTransition(ApplicationState.INITING, ApplicationState.INITING,
ApplicationEventType.APPLICATION_LOG_HANDLING_FAILED,
new AppLogInitFailTransition())
.addTransition(ApplicationState.INITING, ApplicationState.RUNNING,
ApplicationEventType.APPLICATION_INITED,
new AppInitDoneTransition())
@ -237,6 +240,26 @@ public void transition(ApplicationImpl app, ApplicationEvent event) {
}
}
/**
* Handles the APPLICATION_LOG_HANDLING_FAILED event that occurs after
* {@link LogAggregationService} has failed to initialize the log
* aggregation service
*
* In particular, this requests that the {@link ResourceLocalizationService}
* localize the application-scoped resources.
*/
@SuppressWarnings("unchecked")
static class AppLogInitFailTransition implements
SingleArcTransition<ApplicationImpl, ApplicationEvent> {
@Override
public void transition(ApplicationImpl app, ApplicationEvent event) {
LOG.warn("Log Aggregation service failed to initialize, there will " +
"be no logs for this application");
app.dispatcher.getEventHandler().handle(
new ApplicationLocalizationEvent(
LocalizationEventType.INIT_APPLICATION_RESOURCES, app));
}
}
/**
* Handles INIT_CONTAINER events which request that we launch a new
* container. When we're still in the INITTING state, we simply

View File

@ -300,8 +300,9 @@ private void initApp(final ApplicationId appId, String user,
eventResponse = new ApplicationEvent(appId,
ApplicationEventType.APPLICATION_LOG_HANDLING_INITED);
} catch (YarnException e) {
eventResponse = new ApplicationFinishEvent(appId,
"Application failed to init aggregation: " + e.getMessage());
LOG.warn("Application failed to init aggregation: " + e.getMessage());
eventResponse = new ApplicationEvent(appId,
ApplicationEventType.APPLICATION_LOG_HANDLING_FAILED);
}
this.dispatcher.getEventHandler().handle(eventResponse);
}

View File

@ -421,8 +421,8 @@ public void testLogAggregationInitFailsWithoutKillingNM() throws Exception {
dispatcher.await();
ApplicationEvent expectedEvents[] = new ApplicationEvent[]{
new ApplicationFinishEvent(appId,
"Application failed to init aggregation: KABOOM!")
new ApplicationEvent(appId,
ApplicationEventType.APPLICATION_LOG_HANDLING_FAILED)
};
checkEvents(appEventHandler, expectedEvents, false,
"getType", "getApplicationID", "getDiagnostic");
@ -471,8 +471,8 @@ public void testLogAggregationCreateDirsFailsWithoutKillingNM()
dispatcher.await();
ApplicationEvent expectedEvents[] = new ApplicationEvent[]{
new ApplicationFinishEvent(appId,
"Application failed to init aggregation: "+e)
new ApplicationEvent(appId,
ApplicationEventType.APPLICATION_LOG_HANDLING_FAILED)
};
checkEvents(appEventHandler, expectedEvents, false,
"getType", "getApplicationID", "getDiagnostic");