Search in sources :

Example 1 with RMAppRecoverEvent

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));
}
Also used : RMAppImpl(org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl) RMAppEvent(org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent) RMAppRecoverEvent(org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRecoverEvent) ApplicationSubmissionContext(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext) ResourceRequest(org.apache.hadoop.yarn.api.records.ResourceRequest) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId)

Aggregations

ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 ApplicationSubmissionContext (org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext)1 ResourceRequest (org.apache.hadoop.yarn.api.records.ResourceRequest)1 RMAppEvent (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent)1 RMAppImpl (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl)1 RMAppRecoverEvent (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRecoverEvent)1