Search in sources :

Example 16 with RMAppAttemptImpl

use of org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl in project hadoop by apache.

the class RMAppImpl method recover.

@Override
public void recover(RMState state) {
    ApplicationStateData appState = state.getApplicationState().get(getApplicationId());
    this.recoveredFinalState = appState.getState();
    if (recoveredFinalState == null) {
        LOG.info(String.format(RECOVERY_MESSAGE, getApplicationId(), appState.getAttemptCount(), "NONE"));
    } else if (LOG.isDebugEnabled()) {
        LOG.debug(String.format(RECOVERY_MESSAGE, getApplicationId(), appState.getAttemptCount(), recoveredFinalState));
    }
    this.diagnostics.append(null == appState.getDiagnostics() ? "" : appState.getDiagnostics());
    this.storedFinishTime = appState.getFinishTime();
    this.startTime = appState.getStartTime();
    this.callerContext = appState.getCallerContext();
    this.applicationTimeouts = appState.getApplicationTimeouts();
    // If interval > 0, some attempts might have been deleted.
    if (this.attemptFailuresValidityInterval > 0) {
        this.firstAttemptIdInStateStore = appState.getFirstAttemptId();
        this.nextAttemptId = firstAttemptIdInStateStore;
    }
    //TODO recover collector address.
    //this.collectorAddr = appState.getCollectorAddr();
    // send the ATS create Event during RM recovery.
    // NOTE: it could be duplicated with events sent before RM get restarted.
    sendATSCreateEvent();
    RMAppAttemptImpl preAttempt = null;
    for (ApplicationAttemptId attemptId : new TreeSet<>(appState.attempts.keySet())) {
        // create attempt
        createNewAttempt(attemptId);
        ((RMAppAttemptImpl) this.currentAttempt).recover(state);
        // about its final state.
        if (preAttempt != null && preAttempt.getRecoveredFinalState() == null) {
            preAttempt.setRecoveredFinalState(RMAppAttemptState.FAILED);
        }
        preAttempt = (RMAppAttemptImpl) currentAttempt;
    }
    if (currentAttempt != null) {
        nextAttemptId = currentAttempt.getAppAttemptId().getAttemptId() + 1;
    }
}
Also used : TreeSet(java.util.TreeSet) RMAppAttemptImpl(org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl) ApplicationStateData(org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId)

Example 17 with RMAppAttemptImpl

use of org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl in project hadoop by apache.

the class RMAppImpl method createNewAttempt.

private void createNewAttempt(ApplicationAttemptId appAttemptId) {
    BlacklistManager currentAMBlacklistManager;
    if (currentAttempt != null) {
        // Transfer over the blacklist from the previous app-attempt.
        currentAMBlacklistManager = currentAttempt.getAMBlacklistManager();
    } else {
        if (amBlacklistingEnabled && !submissionContext.getUnmanagedAM()) {
            currentAMBlacklistManager = new SimpleBlacklistManager(RMServerUtils.getApplicableNodeCountForAM(rmContext, conf, getAMResourceRequest()), blacklistDisableThreshold);
        } else {
            currentAMBlacklistManager = new DisabledBlacklistManager();
        }
    }
    RMAppAttempt attempt = new RMAppAttemptImpl(appAttemptId, rmContext, scheduler, masterService, submissionContext, conf, amReq, this, currentAMBlacklistManager);
    attempts.put(appAttemptId, attempt);
    currentAttempt = attempt;
}
Also used : DisabledBlacklistManager(org.apache.hadoop.yarn.server.resourcemanager.blacklist.DisabledBlacklistManager) BlacklistManager(org.apache.hadoop.yarn.server.resourcemanager.blacklist.BlacklistManager) SimpleBlacklistManager(org.apache.hadoop.yarn.server.resourcemanager.blacklist.SimpleBlacklistManager) RMAppAttempt(org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt) DisabledBlacklistManager(org.apache.hadoop.yarn.server.resourcemanager.blacklist.DisabledBlacklistManager) RMAppAttemptImpl(org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl) SimpleBlacklistManager(org.apache.hadoop.yarn.server.resourcemanager.blacklist.SimpleBlacklistManager)

Aggregations

RMAppAttemptImpl (org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl)17 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)12 ApplicationSubmissionContext (org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext)11 RMAppImpl (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl)10 RMAppAttemptMetrics (org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptMetrics)10 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)9 Test (org.junit.Test)9 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)8 Container (org.apache.hadoop.yarn.api.records.Container)8 RMContainer (org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer)8 AppAddedSchedulerEvent (org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAddedSchedulerEvent)8 AppAttemptAddedSchedulerEvent (org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptAddedSchedulerEvent)8 AppAttemptRemovedSchedulerEvent (org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptRemovedSchedulerEvent)8 NodeAddedSchedulerEvent (org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent)8 SchedulerEvent (org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent)8 MockRM (org.apache.hadoop.yarn.server.resourcemanager.MockRM)7 ContainerExpiredSchedulerEvent (org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.ContainerExpiredSchedulerEvent)7 NodeRemovedSchedulerEvent (org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeRemovedSchedulerEvent)7 NodeUpdateSchedulerEvent (org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent)7 RMNode (org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode)6