YARN-6819. Application report fails if app rejected due to nodesize. Contributed by Bibin A Chundatt.
This commit is contained in:
parent
daaf530fce
commit
845c4e52bd
|
@ -221,8 +221,9 @@ public abstract class RMStateStore extends AbstractService {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error storing app: " + appId, e);
|
LOG.error("Error storing app: " + appId, e);
|
||||||
if (e instanceof StoreLimitException) {
|
if (e instanceof StoreLimitException) {
|
||||||
store.notifyApplication(new RMAppEvent(appId,
|
store.notifyApplication(
|
||||||
RMAppEventType.APP_REJECTED, e.getMessage(), false));
|
new RMAppEvent(appId, RMAppEventType.APP_SAVE_FAILED,
|
||||||
|
e.getMessage()));
|
||||||
} else {
|
} else {
|
||||||
isFenced = store.notifyStoreOperationFailedInternal(e);
|
isFenced = store.notifyStoreOperationFailedInternal(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ public class RMAppEvent extends AbstractEvent<RMAppEventType>{
|
||||||
|
|
||||||
private final ApplicationId appId;
|
private final ApplicationId appId;
|
||||||
private final String diagnosticMsg;
|
private final String diagnosticMsg;
|
||||||
private boolean storeAppInfo;
|
|
||||||
|
|
||||||
public RMAppEvent(ApplicationId appId, RMAppEventType type) {
|
public RMAppEvent(ApplicationId appId, RMAppEventType type) {
|
||||||
this(appId, type, "");
|
this(appId, type, "");
|
||||||
|
@ -36,21 +35,6 @@ public class RMAppEvent extends AbstractEvent<RMAppEventType>{
|
||||||
super(type);
|
super(type);
|
||||||
this.appId = appId;
|
this.appId = appId;
|
||||||
this.diagnosticMsg = diagnostic;
|
this.diagnosticMsg = diagnostic;
|
||||||
this.storeAppInfo = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor to create RM Application Event type.
|
|
||||||
*
|
|
||||||
* @param appId application Id
|
|
||||||
* @param type RM Event type
|
|
||||||
* @param diagnostic Diagnostic message for event
|
|
||||||
* @param storeApp Application should be saved or not
|
|
||||||
*/
|
|
||||||
public RMAppEvent(ApplicationId appId, RMAppEventType type, String diagnostic,
|
|
||||||
boolean storeApp) {
|
|
||||||
this(appId, type, diagnostic);
|
|
||||||
this.storeAppInfo = storeApp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationId getApplicationId() {
|
public ApplicationId getApplicationId() {
|
||||||
|
@ -61,12 +45,4 @@ public class RMAppEvent extends AbstractEvent<RMAppEventType>{
|
||||||
return this.diagnosticMsg;
|
return this.diagnosticMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store application to state store or not.
|
|
||||||
*
|
|
||||||
* @return boolean application should be saved to store.
|
|
||||||
*/
|
|
||||||
public boolean doStoreAppInfo() {
|
|
||||||
return storeAppInfo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,4 +47,5 @@ public enum RMAppEventType {
|
||||||
// Source: RMStateStore
|
// Source: RMStateStore
|
||||||
APP_NEW_SAVED,
|
APP_NEW_SAVED,
|
||||||
APP_UPDATE_SAVED,
|
APP_UPDATE_SAVED,
|
||||||
|
APP_SAVE_FAILED,
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,6 +243,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
||||||
RMAppEventType.APP_REJECTED,
|
RMAppEventType.APP_REJECTED,
|
||||||
new FinalSavingTransition(new AppRejectedTransition(),
|
new FinalSavingTransition(new AppRejectedTransition(),
|
||||||
RMAppState.FAILED))
|
RMAppState.FAILED))
|
||||||
|
.addTransition(RMAppState.NEW_SAVING, RMAppState.FAILED,
|
||||||
|
RMAppEventType.APP_SAVE_FAILED, new AppRejectedTransition())
|
||||||
|
|
||||||
// Transitions from SUBMITTED state
|
// Transitions from SUBMITTED state
|
||||||
.addTransition(RMAppState.SUBMITTED, RMAppState.SUBMITTED,
|
.addTransition(RMAppState.SUBMITTED, RMAppState.SUBMITTED,
|
||||||
|
@ -1307,12 +1309,10 @@ public class RMAppImpl implements RMApp, Recoverable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transition(RMAppImpl app, RMAppEvent event) {
|
public void transition(RMAppImpl app, RMAppEvent event) {
|
||||||
if (event.doStoreAppInfo()) {
|
|
||||||
app.rememberTargetTransitionsAndStoreState(event, transitionToDo,
|
app.rememberTargetTransitionsAndStoreState(event, transitionToDo,
|
||||||
targetedFinalState, stateToBeStored);
|
targetedFinalState, stateToBeStored);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static class AttemptUnregisteredTransition extends RMAppTransition {
|
private static class AttemptUnregisteredTransition extends RMAppTransition {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -270,20 +270,22 @@ public class TestZKRMStateStore extends RMStateStoreTestBase {
|
||||||
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean get() {
|
public Boolean get() {
|
||||||
return dispatcher.apprejectedEvnt;
|
return dispatcher.appsavefailedEvnt;
|
||||||
}
|
}
|
||||||
}, 100, 5000);
|
}, 100, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class TestAppRejDispatcher extends TestDispatcher {
|
static class TestAppRejDispatcher extends TestDispatcher {
|
||||||
private boolean apprejectedEvnt;
|
private boolean appsavefailedEvnt;
|
||||||
|
|
||||||
public void handle(Event event) {
|
public void handle(Event event) {
|
||||||
if (event instanceof RMAppEvent
|
if (event instanceof RMAppEvent && event.getType()
|
||||||
&& event.getType().equals(RMAppEventType.APP_REJECTED)) {
|
.equals(RMAppEventType.APP_SAVE_FAILED)) {
|
||||||
apprejectedEvnt = true;
|
appsavefailedEvnt = true;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 60000)
|
@Test (timeout = 60000)
|
||||||
|
|
|
@ -652,6 +652,23 @@ public class TestRMAppTransitions {
|
||||||
verifyApplicationFinished(RMAppState.FAILED);
|
verifyApplicationFinished(RMAppState.FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test (timeout = 30000)
|
||||||
|
public void testAppNewSavingSaveReject() throws IOException {
|
||||||
|
LOG.info("--- START: testAppNewSavingSaveReject ---");
|
||||||
|
RMApp application = testCreateAppNewSaving(null);
|
||||||
|
// NEW_SAVING => FAILED event RMAppEventType.APP_SAVE_FAILED
|
||||||
|
String rejectedText = "Test Application Rejected";
|
||||||
|
RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
||||||
|
RMAppEventType.APP_SAVE_FAILED, rejectedText);
|
||||||
|
application.handle(event);
|
||||||
|
rmDispatcher.await();
|
||||||
|
assertFailed(application, rejectedText);
|
||||||
|
verify(store, times(0)).updateApplicationState(
|
||||||
|
any(ApplicationStateData.class));
|
||||||
|
verifyApplicationFinished(RMAppState.FAILED);
|
||||||
|
assertTimesAtFinish(application);
|
||||||
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
public void testAppSubmittedRejected() throws IOException {
|
public void testAppSubmittedRejected() throws IOException {
|
||||||
LOG.info("--- START: testAppSubmittedRejected ---");
|
LOG.info("--- START: testAppSubmittedRejected ---");
|
||||||
|
|
Loading…
Reference in New Issue