use of org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRecoverEvent in project hadoop by apache.
the class RMAppManager method recoverApplication.
protected void recoverApplication(ApplicationStateData appState, RMState rmState) throws Exception {
ApplicationSubmissionContext appContext = appState.getApplicationSubmissionContext();
ApplicationId appId = appContext.getApplicationId();
// create and recover app.
RMAppImpl application = createAndPopulateNewRMApp(appContext, appState.getSubmitTime(), appState.getUser(), true, appState.getStartTime());
// is true and give clear message so that user can react properly.
if (!appContext.getUnmanagedAM() && application.getAMResourceRequest() == null && !YarnConfiguration.areNodeLabelsEnabled(this.conf)) {
// check application submission context and see if am resource request
// or application itself contains any node label expression.
ResourceRequest amReqFromAppContext = appContext.getAMContainerResourceRequest();
String labelExp = (amReqFromAppContext != null) ? amReqFromAppContext.getNodeLabelExpression() : null;
if (labelExp == null) {
labelExp = appContext.getNodeLabelExpression();
}
if (labelExp != null && !labelExp.equals(RMNodeLabelsManager.NO_LABEL)) {
String message = "Failed to recover application " + appId + ". NodeLabel is not enabled in cluster, but AM resource request " + "contains a label expression.";
LOG.warn(message);
application.handle(new RMAppEvent(appId, RMAppEventType.APP_REJECTED, message));
return;
}
}
application.handle(new RMAppRecoverEvent(appId, rmState));
}
Aggregations