YARN-6948. Invalid event: ATTEMPT_ADDED at FINAL_SAVING. Contributed by lujie
This commit is contained in:
parent
ebff4decfe
commit
90c86d6e09
@ -418,7 +418,8 @@ RMAppAttemptEventType.STATUS_UPDATE, new StatusUpdateTransition())
|
||||
RMAppAttemptEventType.CONTAINER_ALLOCATED,
|
||||
RMAppAttemptEventType.ATTEMPT_NEW_SAVED,
|
||||
RMAppAttemptEventType.KILL,
|
||||
RMAppAttemptEventType.FAIL))
|
||||
RMAppAttemptEventType.FAIL,
|
||||
RMAppAttemptEventType.ATTEMPT_ADDED))
|
||||
|
||||
// Transitions from FAILED State
|
||||
// For work-preserving AM restart, failed attempt are still capturing
|
||||
@ -909,7 +910,7 @@ public void handle(RMAppAttemptEvent event) {
|
||||
} catch (InvalidStateTransitionException e) {
|
||||
LOG.error("App attempt: " + appAttemptID
|
||||
+ " can't handle this event at current state", e);
|
||||
/* TODO fail the application on the failed transition */
|
||||
onInvalidTranstion(event.getType(), oldState);
|
||||
}
|
||||
|
||||
// Log at INFO if we're not recovering or not in a terminal state.
|
||||
@ -2240,4 +2241,8 @@ public Set<String> getBlacklistedNodes() {
|
||||
return Collections.EMPTY_SET;
|
||||
}
|
||||
|
||||
protected void onInvalidTranstion(RMAppAttemptEventType rmAppAttemptEventType,
|
||||
RMAppAttemptState state){
|
||||
/* TODO fail the application on the failed transition */
|
||||
}
|
||||
}
|
||||
|
@ -327,7 +327,15 @@ public void setUp() throws Exception {
|
||||
masterService, submissionContext, new Configuration(),
|
||||
Collections.singletonList(BuilderUtils.newResourceRequest(
|
||||
RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY,
|
||||
submissionContext.getResource(), 1)), application);
|
||||
submissionContext.getResource(), 1)), application) {
|
||||
@Override
|
||||
protected void onInvalidTranstion(
|
||||
RMAppAttemptEventType rmAppAttemptEventType,
|
||||
RMAppAttemptState state) {
|
||||
Assert.assertTrue("RMAppAttemptImpl can't handle "
|
||||
+ rmAppAttemptEventType + " at state " + state, false);
|
||||
}
|
||||
};
|
||||
|
||||
when(application.getCurrentAppAttempt()).thenReturn(applicationAttempt);
|
||||
when(application.getApplicationId()).thenReturn(applicationId);
|
||||
@ -974,6 +982,23 @@ public void testLaunchedAtFinalSaving() {
|
||||
applicationAttempt.getAppAttemptState());
|
||||
}
|
||||
|
||||
@Test(timeout = 10000)
|
||||
public void testAttemptAddedAtFinalSaving() {
|
||||
submitApplicationAttempt();
|
||||
|
||||
// SUBNITED->FINAL_SAVING
|
||||
applicationAttempt.handle(new RMAppAttemptEvent(applicationAttempt
|
||||
.getAppAttemptId(), RMAppAttemptEventType.KILL));
|
||||
assertEquals(RMAppAttemptState.FINAL_SAVING,
|
||||
applicationAttempt.getAppAttemptState());
|
||||
|
||||
applicationAttempt.handle(new RMAppAttemptEvent(applicationAttempt
|
||||
.getAppAttemptId(), RMAppAttemptEventType.ATTEMPT_ADDED));
|
||||
|
||||
assertEquals(RMAppAttemptState.FINAL_SAVING,
|
||||
applicationAttempt.getAppAttemptState());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAMCrashAtAllocated() {
|
||||
Container amContainer = allocateApplicationAttempt();
|
||||
|
Loading…
Reference in New Issue
Block a user