@Override public boolean isAppInCompletedStates() { RMAppState appState = getState(); return appState == RMAppState.FINISHED || appState == RMAppState.FINISHING || appState == RMAppState.FAILED || appState == RMAppState.KILLED || appState == RMAppState.FINAL_SAVING || appState == RMAppState.KILLING; }
@Override public void handle(RMAppEvent event) { this.writeLock.lock(); try { ApplicationId appID = event.getApplicationId(); LOG.debug("Processing event for " + appID + " of type " + event.getType()); final RMAppState oldState = getState(); try { /* keep the master in sync with the state machine */ this.stateMachine.doTransition(event.getType(), event); } catch (InvalidStateTransitonException e) { LOG.error("Can't handle this event at current state", e); /* TODO fail the application on the failed transition */ } if (oldState != getState()) { LOG.info(appID + " State change from " + oldState + " to " + getState()); } } finally { this.writeLock.unlock(); } }
public void updateApplicationTimeout( Map<ApplicationTimeoutType, Long> updateTimeout) { this.writeLock.lock(); try { if (COMPLETED_APP_STATES.contains(getState())) { return; } // update monitoring service this.rmContext.getRMAppLifetimeMonitor() .updateApplicationTimeouts(getApplicationId(), updateTimeout); this.applicationTimeouts.putAll(updateTimeout); } finally { this.writeLock.unlock(); } }
@Override public void handle(RMAppEvent event) { this.writeLock.lock(); try { ApplicationId appID = event.getApplicationId(); LOG.debug("Processing event for " + appID + " of type " + event.getType()); final RMAppState oldState = getState(); try { /* keep the master in sync with the state machine */ this.stateMachine.doTransition(event.getType(), event); } catch (InvalidStateTransitonException e) { LOG.error("Can't handle this event at current state", e); /* TODO fail the application on the failed transition */ } if (oldState != getState()) { LOG.info(appID + " State change from " + oldState + " to " + getState() + " on event=" + event.getType()); } } finally { this.writeLock.unlock(); } }
LOG.debug("Processing event for " + appID + " of type " + event.getType()); final RMAppState oldState = getState(); try { if ((oldState != getState()) && (((recoveredFinalState == null)) || (event.getType() != RMAppEventType.RECOVER))) { LOG.info(String.format(STATE_CHANGE_MESSAGE, appID, oldState, getState(), event.getType())); } else if ((oldState != getState()) && LOG.isDebugEnabled()) { LOG.debug(String.format(STATE_CHANGE_MESSAGE, appID, oldState, getState(), event.getType()));
@Override public YarnApplicationState createApplicationState() { RMAppState rmAppState = getState(); // If App is in FINAL_SAVING state, return its previous state. if (rmAppState.equals(RMAppState.FINAL_SAVING)) { rmAppState = stateBeforeFinalSaving; } if (rmAppState.equals(RMAppState.KILLING)) { rmAppState = stateBeforeKilling; } return RMServerUtils.createApplicationState(rmAppState); }
@Override public YarnApplicationState createApplicationState() { RMAppState rmAppState = getState(); // If App is in FINAL_SAVING state, return its previous state. if (rmAppState.equals(RMAppState.FINAL_SAVING)) { rmAppState = stateBeforeFinalSaving; } if (rmAppState.equals(RMAppState.KILLING)) { rmAppState = stateBeforeKilling; } return RMServerUtils.createApplicationState(rmAppState); }
@Override public YarnApplicationState createApplicationState() { RMAppState rmAppState = getState(); // If App is in FINAL_SAVING state, return its previous state. if (rmAppState.equals(RMAppState.FINAL_SAVING)) { rmAppState = stateBeforeFinalSaving; } if (rmAppState.equals(RMAppState.KILLING)) { rmAppState = stateBeforeKilling; } return RMServerUtils.createApplicationState(rmAppState); }
@Override public void transition(RMAppImpl app, RMAppEvent event) { app.stateBeforeKilling = app.getState(); // Forward app kill diagnostics in the event to kill app attempt. // These diagnostics will be returned back in ATTEMPT_KILLED event sent by // RMAppAttemptImpl. app.handler.handle( new RMAppAttemptEvent(app.currentAttempt.getAppAttemptId(), RMAppAttemptEventType.KILL, event.getDiagnosticMsg())); } }
@Override public boolean isAppFinalStateStored() { RMAppState state = getState(); return state.equals(RMAppState.FINISHING) || state.equals(RMAppState.FINISHED) || state.equals(RMAppState.FAILED) || state.equals(RMAppState.KILLED); }
@Override public boolean isAppFinalStateStored() { RMAppState state = getState(); return state.equals(RMAppState.FINISHING) || state.equals(RMAppState.FINISHED) || state.equals(RMAppState.FAILED) || state.equals(RMAppState.KILLED); }
@Override public boolean isAppFinalStateStored() { RMAppState state = getState(); return state.equals(RMAppState.FINISHING) || state.equals(RMAppState.FINISHED) || state.equals(RMAppState.FAILED) || state.equals(RMAppState.KILLED); }
@Override public void transition(RMAppImpl app, RMAppEvent event) { app.stateBeforeKilling = app.getState(); // Forward app kill diagnostics in the event to kill app attempt. // These diagnostics will be returned back in ATTEMPT_KILLED event sent by // RMAppAttemptImpl. app.handler.handle( new RMAppAttemptEvent(app.currentAttempt.getAppAttemptId(), RMAppAttemptEventType.KILL, event.getDiagnosticMsg())); RMAppImpl.auditLogKillEvent(event); } }
@Override public void transition(RMAppImpl app, RMAppEvent event) { app.stateBeforeKilling = app.getState(); // Forward app kill diagnostics in the event to kill app attempt. // These diagnostics will be returned back in ATTEMPT_KILLED event sent by // RMAppAttemptImpl. app.handler.handle( new RMAppAttemptEvent(app.currentAttempt.getAppAttemptId(), RMAppAttemptEventType.KILL, event.getDiagnosticMsg())); RMAppImpl.auditLogKillEvent(event); } }
RMAppState stateToBeStored) { rememberTargetTransitions(event, transitionToDo, targetFinalState); this.stateBeforeFinalSaving = getState(); this.storedFinishTime = this.systemClock.getTime();
RMAppState stateToBeStored) { rememberTargetTransitions(event, transitionToDo, targetFinalState); this.stateBeforeFinalSaving = getState(); this.storedFinishTime = this.systemClock.getTime();
RMAppState stateToBeStored) { rememberTargetTransitions(event, transitionToDo, targetFinalState); this.stateBeforeFinalSaving = getState(); this.storedFinishTime = this.systemClock.getTime();
assert application.getState() == RMAppState.NEW; this.rmContext.getDispatcher().getEventHandler() .handle(new RMAppEvent(applicationId,
RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY, submissionContext.getResource(), 1))); Assert.assertEquals(RMAppState.NEW, application.getState()); RMAppState finalState = appState.getState(); Assert.assertEquals("Application is not in finalState.", finalState, application.getState()); verifyRMAppFieldsForFinalTransitions(application);
public void testRecoverApplication(ApplicationStateData appState, RMState rmState) throws Exception { ApplicationSubmissionContext submissionContext = appState.getApplicationSubmissionContext(); RMAppImpl application = new RMAppImpl( appState.getApplicationSubmissionContext().getApplicationId(), rmContext, conf, submissionContext.getApplicationName(), null, submissionContext.getQueue(), submissionContext, null, null, appState.getSubmitTime(), submissionContext.getApplicationType(), submissionContext.getApplicationTags(), BuilderUtils.newResourceRequest( RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY, submissionContext.getResource(), 1)); Assert.assertEquals(RMAppState.NEW, application.getState()); RMAppEvent recoverEvent = new RMAppRecoverEvent(application.getApplicationId(), rmState); // Trigger RECOVER event. application.handle(recoverEvent); // Application final status looked from recoveredFinalStatus Assert.assertTrue("Application is not in recoveredFinalStatus.", RMAppImpl.isAppInFinalState(application)); rmDispatcher.await(); RMAppState finalState = appState.getState(); Assert.assertEquals("Application is not in finalState.", finalState, application.getState()); }