Package org.apache.hadoop.yarn.server.resourcemanager.recovery

Examples of org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore


      break;
    default:
      break;
    }

    RMStateStore rmStore = rmContext.getStateStore();
    ApplicationAttemptState attemptState =
        new ApplicationAttemptState(applicationAttemptId, getMasterContainer(),
          rmStore.getCredentialsFromAppAttempt(this), startTime,
          stateToBeStored, finalTrackingUrl, diags, finalStatus);
    LOG.info("Updating application attempt " + applicationAttemptId
        + " with final state: " + targetedFinalState);
    rmStore.updateApplicationAttemptState(attemptState);
  }
View Full Code Here


      boolean isRecoveryEnabled = conf.getBoolean(
          YarnConfiguration.RECOVERY_ENABLED,
          YarnConfiguration.DEFAULT_RM_RECOVERY_ENABLED);

      RMStateStore rmStore = null;
      if(isRecoveryEnabled) {
        recoveryEnabled = true;
        rmStore =  RMStateStoreFactory.getStore(conf);
      } else {
        recoveryEnabled = false;
        rmStore = new NullRMStateStore();
      }

      try {
        rmStore.init(conf);
        rmStore.setRMDispatcher(rmDispatcher);
      } catch (Exception e) {
        // the Exception from stateStore.init() needs to be handled for
        // HA and we need to give up master status if we got fenced
        LOG.error("Failed to init state store", e);
        throw e;
View Full Code Here

      super.serviceInit(conf);
    }

    @Override
    protected void serviceStart() throws Exception {
      RMStateStore rmStore = rmContext.getStateStore();
      // The state store needs to start irrespective of recoveryEnabled as apps
      // need events to move to further states.
      rmStore.start();

      if(recoveryEnabled) {
        try {
          rmStore.checkVersion();
          RMState state = rmStore.loadState();
          recover(state);
        } catch (Exception e) {
          // the Exception from loadState() needs to be handled for
          // HA and we need to give up master status if we got fenced
          LOG.error("Failed to load/recover state", e);
View Full Code Here

    protected void serviceStop() throws Exception {

      DefaultMetricsSystem.shutdown();

      if (rmContext != null) {
        RMStateStore store = rmContext.getStateStore();
        try {
          store.close();
        } catch (Exception e) {
          LOG.error("Error closing store.", e);
        }
      }
View Full Code Here

  public void testConcurrentAppSubmit()
      throws IOException, InterruptedException, BrokenBarrierException {
    YarnScheduler yarnScheduler = mock(YarnScheduler.class);
    RMContext rmContext = mock(RMContext.class);
    mockRMContext(yarnScheduler, rmContext);
    RMStateStore stateStore = mock(RMStateStore.class);
    when(rmContext.getStateStore()).thenReturn(stateStore);
    RMAppManager appManager = new RMAppManager(rmContext, yarnScheduler,
        null, mock(ApplicationACLsManager.class), new Configuration());

    final ApplicationId appId1 = getApplicationId(100);
View Full Code Here

     
      completedApps.add(applicationId)
      writeAuditLog(applicationId);
     
      // application completely done. Remove from state
      RMStateStore store = rmContext.getStateStore();
      store.removeApplication(rmContext.getRMApps().get(applicationId));
    }
  }
View Full Code Here

    return credentials;
  }
 
  @Override
  public void recover(RMState state) throws Exception {
    RMStateStore store = rmContext.getStateStore();
    assert store != null;
    // recover applications
    Map<ApplicationId, ApplicationState> appStates = state.getApplicationState();
    LOG.info("Recovering " + appStates.size() + " applications");
    for(ApplicationState appState : appStates.values()) {
      // re-submit the application
      // this is going to send an app start event but since the async dispatcher
      // has not started that event will be queued until we have completed re
      // populating the state
      if(appState.getApplicationSubmissionContext().getUnmanagedAM()) {
        // do not recover unmanaged applications since current recovery
        // mechanism of restarting attempts does not work for them.
        // This will need to be changed in work preserving recovery in which
        // RM will re-connect with the running AM's instead of restarting them
        LOG.info("Not recovering unmanaged application " + appState.getAppId());
        store.removeApplication(appState);
      } else {
        LOG.info("Recovering application " + appState.getAppId());
        submitApplication(appState.getApplicationSubmissionContext(),
                          appState.getSubmitTime());
        // re-populate attempt information in application
View Full Code Here

      RMContainerTokenSecretManager containerTokenSecretManager,
      ClientToAMTokenSecretManagerInRM clientTokenSecretManager) {
    this(rmDispatcher, null, containerAllocationExpirer, amLivelinessMonitor,
          amFinishingMonitor, tokenRenewer, appTokenSecretManager,
          containerTokenSecretManager, clientTokenSecretManager);
    RMStateStore nullStore = new NullRMStateStore();
    nullStore.setDispatcher(rmDispatcher);
    try {
      nullStore.init(new YarnConfiguration());
      setStateStore(nullStore);
    } catch (Exception e) {
      assert false;
    }
  }
View Full Code Here

   
    boolean isRecoveryEnabled = conf.getBoolean(
        YarnConfiguration.RECOVERY_ENABLED,
        YarnConfiguration.DEFAULT_RM_RECOVERY_ENABLED);
   
    RMStateStore rmStore = null;
    if(isRecoveryEnabled) {
      recoveryEnabled = true;
      rmStore =  RMStateStoreFactory.getStore(conf);
    } else {
      recoveryEnabled = false;
      rmStore = new NullRMStateStore();
    }
    try {
      rmStore.init(conf);
      rmStore.setDispatcher(rmDispatcher);
    } catch (Exception e) {
      // the Exception from stateStore.init() needs to be handled for
      // HA and we need to give up master status if we got fenced
      LOG.error("Failed to init state store", e);
      ExitUtil.terminate(1, e);
View Full Code Here

    this.appTokenSecretManager.start();
    this.containerTokenSecretManager.start();

    if(recoveryEnabled) {
      try {
        RMStateStore rmStore = rmContext.getStateStore();
        RMState state = rmStore.loadState();
        recover(state);
      } catch (Exception e) {
        // the Exception from loadState() needs to be handled for
        // HA and we need to give up master status if we got fenced
        LOG.error("Failed to load/recover state", e);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.