当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationStateData类代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData的典型用法代码示例。如果您正苦于以下问题:Java ApplicationStateData类的具体用法?Java ApplicationStateData怎么用?Java ApplicationStateData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ApplicationStateData类属于org.apache.hadoop.yarn.server.resourcemanager.recovery.records包,在下文中一共展示了ApplicationStateData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recover

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public void recover(RMState state) {
  ApplicationStateData appState =
      state.getApplicationState().get(getApplicationId());
  this.recoveredFinalState = appState.getState();
  LOG.info("Recovering app: " + getApplicationId() + " with " + 
      + appState.getAttemptCount() + " attempts and final state = "
      + this.recoveredFinalState );
  this.diagnostics.append(appState.getDiagnostics());
  this.storedFinishTime = appState.getFinishTime();
  this.startTime = appState.getStartTime();

  for(int i=0; i<appState.getAttemptCount(); ++i) {
    // create attempt
    createNewAttempt();
    ((RMAppAttemptImpl)this.currentAttempt).recover(state);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:RMAppImpl.java

示例2: removeApplicationStateInternal

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
protected void removeApplicationStateInternal(ApplicationStateData appState)
    throws IOException {
  ApplicationId appId =
      appState.getApplicationSubmissionContext().getApplicationId();
  String appKey = getApplicationNodeKey(appId);
  try {
    WriteBatch batch = db.createWriteBatch();
    try {
      batch.delete(bytes(appKey));
      for (ApplicationAttemptId attemptId : appState.attempts.keySet()) {
        String attemptKey = getApplicationAttemptNodeKey(appKey, attemptId);
        batch.delete(bytes(attemptKey));
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug("Removing state for app " + appId + " and "
            + appState.attempts.size() + " attempts" + " at " + appKey);
      }
      db.write(batch);
    } finally {
      batch.close();
    }
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:LeveldbRMStateStore.java

示例3: loadApplicationAttemptState

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
private void loadApplicationAttemptState(ApplicationStateData appState,
    ApplicationId appId)
    throws Exception {
  String appPath = getNodePath(rmAppRoot, appId.toString());
  List<String> attempts = getChildrenWithRetries(appPath, false);
  for (String attemptIDStr : attempts) {
    if (attemptIDStr.startsWith(ApplicationAttemptId.appAttemptIdStrPrefix)) {
      String attemptPath = getNodePath(appPath, attemptIDStr);
      byte[] attemptData = getDataWithRetries(attemptPath, false);

      ApplicationAttemptStateDataPBImpl attemptState =
          new ApplicationAttemptStateDataPBImpl(
              ApplicationAttemptStateDataProto.parseFrom(attemptData));

      appState.attempts.put(attemptState.getAttemptId(), attemptState);
    }
  }
  LOG.debug("Done loading applications from ZK state store");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:ZKRMStateStore.java

示例4: updateApplicationStateInternal

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public synchronized void updateApplicationStateInternal(ApplicationId appId,
    ApplicationStateData appStateDataPB) throws Exception {
  String nodeUpdatePath = getNodePath(rmAppRoot, appId.toString());

  if (LOG.isDebugEnabled()) {
    LOG.debug("Storing final state info for app: " + appId + " at: "
        + nodeUpdatePath);
  }
  byte[] appStateData = appStateDataPB.getProto().toByteArray();

  if (existsWithRetries(nodeUpdatePath, false) != null) {
    setDataWithRetries(nodeUpdatePath, appStateData, -1);
  } else {
    createWithRetries(nodeUpdatePath, appStateData, zkAcl,
      CreateMode.PERSISTENT);
    LOG.debug(appId + " znode didn't exist. Created a new znode to"
        + " update the application state.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:ZKRMStateStore.java

示例5: removeApplicationStateInternal

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public synchronized void removeApplicationStateInternal(
    ApplicationStateData  appState)
    throws Exception {
  String appId = appState.getApplicationSubmissionContext().getApplicationId()
      .toString();
  String appIdRemovePath = getNodePath(rmAppRoot, appId);
  ArrayList<Op> opList = new ArrayList<Op>();

  for (ApplicationAttemptId attemptId : appState.attempts.keySet()) {
    String attemptRemovePath = getNodePath(appIdRemovePath, attemptId.toString());
    opList.add(Op.delete(attemptRemovePath, -1));
  }
  opList.add(Op.delete(appIdRemovePath, -1));

  if (LOG.isDebugEnabled()) {
    LOG.debug("Removing info for app: " + appId + " at: " + appIdRemovePath
        + " and its attempts.");
  }
  doDeleteMultiWithRetries(opList);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ZKRMStateStore.java

示例6: storeApplicationStateInternal

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public synchronized void storeApplicationStateInternal(ApplicationId appId,
    ApplicationStateData appStateDataPB) throws Exception {
  Path appDirPath = getAppDir(rmAppRoot, appId);
  mkdirsWithRetries(appDirPath);
  Path nodeCreatePath = getNodePath(appDirPath, appId.toString());

  LOG.info("Storing info for app: " + appId + " at: " + nodeCreatePath);
  byte[] appStateData = appStateDataPB.getProto().toByteArray();
  try {
    // currently throw all exceptions. May need to respond differently for HA
    // based on whether we have lost the right to write to FS
    writeFileWithRetries(nodeCreatePath, appStateData, true);
  } catch (Exception e) {
    LOG.info("Error storing info for app: " + appId, e);
    throw e;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:FileSystemRMStateStore.java

示例7: updateApplicationStateInternal

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public synchronized void updateApplicationStateInternal(ApplicationId appId,
    ApplicationStateData appStateDataPB) throws Exception {
  Path appDirPath = getAppDir(rmAppRoot, appId);
  Path nodeCreatePath = getNodePath(appDirPath, appId.toString());

  LOG.info("Updating info for app: " + appId + " at: " + nodeCreatePath);
  byte[] appStateData = appStateDataPB.getProto().toByteArray();
  try {
    // currently throw all exceptions. May need to respond differently for HA
    // based on whether we have lost the right to write to FS
    updateFile(nodeCreatePath, appStateData, true);
  } catch (Exception e) {
    LOG.info("Error updating info for app: " + appId, e);
    throw e;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:FileSystemRMStateStore.java

示例8: transition

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public void transition(RMStateStore store, RMStateStoreEvent event) {
  if (!(event instanceof RMStateStoreAppEvent)) {
    // should never happen
    LOG.error("Illegal event type: " + event.getClass());
    return;
  }
  ApplicationStateData appState =
      ((RMStateStoreAppEvent) event).getAppState();
  ApplicationId appId =
      appState.getApplicationSubmissionContext().getApplicationId();
  LOG.info("Storing info for app: " + appId);
  try {
    store.storeApplicationStateInternal(appId, appState);
    store.notifyApplication(new RMAppEvent(appId,
           RMAppEventType.APP_NEW_SAVED));
  } catch (Exception e) {
    LOG.error("Error storing app: " + appId, e);
    store.notifyStoreOperationFailed(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:RMStateStore.java

示例9: finishApplicationMaster

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
private void finishApplicationMaster(RMApp rmApp, MockRM rm, MockNM nm,
    MockAM am, FinishApplicationMasterRequest req) throws Exception {
  RMState rmState =
      ((MemoryRMStateStore) rm.getRMContext().getStateStore()).getState();
  Map<ApplicationId, ApplicationStateData> rmAppState =
      rmState.getApplicationState();
  am.unregisterAppAttempt(req,true);
  am.waitForState(RMAppAttemptState.FINISHING);
  nm.nodeHeartbeat(am.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  am.waitForState(RMAppAttemptState.FINISHED);
  rm.waitForState(rmApp.getApplicationId(), RMAppState.FINISHED);
  // check that app/attempt is saved with the final state
  ApplicationStateData appState = rmAppState.get(rmApp.getApplicationId());
  Assert
    .assertEquals(RMAppState.FINISHED, appState.getState());
  Assert.assertEquals(RMAppAttemptState.FINISHED,
    appState.getAttempt(am.getApplicationAttemptId()).getState());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestRMRestart.java

示例10: testCreateAppSubmittedRecovery

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
protected RMApp testCreateAppSubmittedRecovery(
    ApplicationSubmissionContext submissionContext) throws IOException {
  RMApp application = createNewTestApp(submissionContext);
  // NEW => SUBMITTED event RMAppEventType.RECOVER
  RMState state = new RMState();
  ApplicationStateData appState =
      ApplicationStateData.newInstance(123, 123, null, "user");
  state.getApplicationState().put(application.getApplicationId(), appState);
  RMAppEvent event =
      new RMAppRecoverEvent(application.getApplicationId(), state);


  application.handle(event);
  assertStartTimeSet(application);
  assertAppState(RMAppState.SUBMITTED, application);
  return application;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestRMAppTransitions.java

示例11: recover

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public void recover(RMState state) {
  ApplicationStateData appState =
      state.getApplicationState().get(getApplicationId());
  this.recoveredFinalState = appState.getState();
  LOG.info("Recovering app: " + getApplicationId() + " with " + 
      + appState.getAttemptCount() + " attempts and final state = "
      + this.recoveredFinalState );
  this.diagnostics.append(null == appState.getDiagnostics() ? "" : appState
      .getDiagnostics());
  this.storedFinishTime = appState.getFinishTime();
  this.startTime = appState.getStartTime();
  this.callerContext = appState.getCallerContext();

  // send the ATS create Event
  sendATSCreateEvent(this, this.startTime);

  for(int i=0; i<appState.getAttemptCount(); ++i) {
    // create attempt
    createNewAttempt();
    ((RMAppAttemptImpl)this.currentAttempt).recover(state);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:RMAppImpl.java

示例12: removeApplicationStateInternal

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public synchronized void removeApplicationStateInternal(
    ApplicationStateData  appState)
    throws Exception {
  String appId = appState.getApplicationSubmissionContext().getApplicationId()
      .toString();
  String appIdRemovePath = getNodePath(rmAppRoot, appId);

  if (LOG.isDebugEnabled()) {
    LOG.debug("Removing info for app: " + appId + " at: " + appIdRemovePath
        + " and its attempts.");
  }

  for (ApplicationAttemptId attemptId : appState.attempts.keySet()) {
    String attemptRemovePath = getNodePath(appIdRemovePath, attemptId.toString());
    safeDelete(attemptRemovePath);
  }
  safeDelete(appIdRemovePath);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:ZKRMStateStore.java

示例13: transition

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
@Override
public RMStateStoreState transition(RMStateStore store,
    RMStateStoreEvent event) {
  if (!(event instanceof RMStateStoreAppEvent)) {
    // should never happen
    LOG.error("Illegal event type: " + event.getClass());
    return RMStateStoreState.ACTIVE;
  }
  boolean isFenced = false;
  ApplicationStateData appState =
      ((RMStateStoreAppEvent) event).getAppState();
  ApplicationId appId =
      appState.getApplicationSubmissionContext().getApplicationId();
  LOG.info("Storing info for app: " + appId);
  try {
    store.storeApplicationStateInternal(appId, appState);
    store.notifyApplication(new RMAppEvent(appId,
           RMAppEventType.APP_NEW_SAVED));
  } catch (Exception e) {
    LOG.error("Error storing app: " + appId, e);
    isFenced = store.notifyStoreOperationFailedInternal(e);
  }
  return finalState(isFenced);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:RMStateStore.java

示例14: rememberTargetTransitionsAndStoreState

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
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:
    RMAppRejectedEvent rejectedEvent = (RMAppRejectedEvent) event;
    diags = rejectedEvent.getMessage();
    break;
  case ATTEMPT_FINISHED:
    RMAppFinishedAttemptEvent finishedEvent =
        (RMAppFinishedAttemptEvent) event;
    diags = finishedEvent.getDiagnostics();
    break;
  case ATTEMPT_FAILED:
    RMAppFailedAttemptEvent failedEvent = (RMAppFailedAttemptEvent) event;
    diags = getAppAttemptFailedDiagnostics(failedEvent);
    break;
  case ATTEMPT_KILLED:
    diags = getAppKilledDiagnostics();
    break;
  default:
    break;
  }
  ApplicationStateData appState =
      ApplicationStateData.newInstance(this.submitTime, this.startTime,
          this.user, this.submissionContext,
          stateToBeStored, diags, this.storedFinishTime);
  this.rmContext.getStateStore().updateApplicationState(appState);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:RMAppImpl.java

示例15: recoverApplication

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData; //导入依赖的package包/类
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);

  application.handle(new RMAppRecoverEvent(appId, rmState));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:RMAppManager.java


注:本文中的org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。