use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData in project hadoop by apache.
the class RMAppManager method recover.
@Override
public void recover(RMState state) throws Exception {
RMStateStore store = rmContext.getStateStore();
assert store != null;
// recover applications
Map<ApplicationId, ApplicationStateData> appStates = state.getApplicationState();
LOG.info("Recovering " + appStates.size() + " applications");
int count = 0;
try {
for (ApplicationStateData appState : appStates.values()) {
recoverApplication(appState, state);
count += 1;
}
} finally {
LOG.info("Successfully recovered " + count + " out of " + appStates.size() + " applications");
}
}
use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData in project hadoop by apache.
the class MemoryRMStateStore method storeApplicationAttemptStateInternal.
@Override
public synchronized void storeApplicationAttemptStateInternal(ApplicationAttemptId appAttemptId, ApplicationAttemptStateData attemptState) throws Exception {
ApplicationStateData appState = state.getApplicationState().get(attemptState.getAttemptId().getApplicationId());
if (appState == null) {
throw new YarnRuntimeException("Application doesn't exist");
}
appState.attempts.put(attemptState.getAttemptId(), attemptState);
}
use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData in project hadoop by apache.
the class MemoryRMStateStore method removeApplicationAttemptInternal.
@Override
public synchronized void removeApplicationAttemptInternal(ApplicationAttemptId appAttemptId) throws Exception {
ApplicationStateData appState = state.getApplicationState().get(appAttemptId.getApplicationId());
ApplicationAttemptStateData attemptState = appState.attempts.remove(appAttemptId);
LOG.info("Removing state for attempt: " + appAttemptId);
if (attemptState == null) {
throw new YarnRuntimeException("Application doesn't exist");
}
}
use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData in project hadoop by apache.
the class FileSystemRMStateStore method loadRMAppState.
private void loadRMAppState(RMState rmState) throws Exception {
try {
List<ApplicationAttemptStateData> attempts = new ArrayList<>();
final RMAppStateFileProcessor rmAppStateFileProcessor = new RMAppStateFileProcessor(rmState, attempts);
final Path rootDirectory = this.rmAppRoot;
processDirectoriesOfFiles(rmAppStateFileProcessor, rootDirectory);
// directory operation remove both at the same time
for (ApplicationAttemptStateData attemptState : attempts) {
ApplicationId appId = attemptState.getAttemptId().getApplicationId();
ApplicationStateData appState = rmState.appState.get(appId);
assert appState != null;
appState.attempts.put(attemptState.getAttemptId(), attemptState);
}
LOG.info("Done loading applications from FS state store");
} catch (Exception e) {
LOG.error("Failed to load state.", e);
throw e;
}
}
use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData in project hadoop by apache.
the class RMAppImpl method rememberTargetTransitionsAndStoreState.
private void rememberTargetTransitionsAndStoreState(RMAppEvent event, Object transitionToDo, RMAppState targetFinalState, RMAppState stateToBeStored) {
rememberTargetTransitions(event, transitionToDo, targetFinalState);
this.stateBeforeFinalSaving = getState();
this.storedFinishTime = this.systemClock.getTime();
LOG.info("Updating application " + this.applicationId + " with final state: " + this.targetedFinalState);
// we lost attempt_finished diagnostics in app, because attempt_finished
// diagnostics is sent after app final state is saved. Later on, we will
// create GetApplicationAttemptReport specifically for getting per attempt
// info.
String diags = null;
switch(event.getType()) {
case APP_REJECTED:
case ATTEMPT_FINISHED:
case ATTEMPT_KILLED:
diags = event.getDiagnosticMsg();
break;
case ATTEMPT_FAILED:
RMAppFailedAttemptEvent failedEvent = (RMAppFailedAttemptEvent) event;
diags = getAppAttemptFailedDiagnostics(failedEvent);
break;
default:
break;
}
ApplicationStateData appState = ApplicationStateData.newInstance(this.submitTime, this.startTime, this.user, this.submissionContext, stateToBeStored, diags, this.storedFinishTime, this.callerContext);
appState.setApplicationTimeouts(this.applicationTimeouts);
this.rmContext.getStateStore().updateApplicationState(appState);
}
Aggregations