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


Java ApplicationAttemptStateData.newInstance方法代码示例

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


在下文中一共展示了ApplicationAttemptStateData.newInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: storeNewApplicationAttempt

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
/**
 * Non-blocking API
 * ResourceManager services call this to store state on an application attempt
 * This does not block the dispatcher threads
 * RMAppAttemptStoredEvent will be sent on completion to notify the RMAppAttempt
 */
public synchronized void storeNewApplicationAttempt(RMAppAttempt appAttempt) {
  Credentials credentials = getCredentialsFromAppAttempt(appAttempt);

  AggregateAppResourceUsage resUsage =
      appAttempt.getRMAppAttemptMetrics().getAggregateAppResourceUsage();
  ApplicationAttemptStateData attemptState =
      ApplicationAttemptStateData.newInstance(
          appAttempt.getAppAttemptId(),
          appAttempt.getMasterContainer(),
          credentials, appAttempt.getStartTime(),
          resUsage.getMemorySeconds(),
          resUsage.getVcoreSeconds(),resUsage.getGcoreSeconds());

  dispatcher.getEventHandler().handle(
    new RMStateStoreAppAttemptEvent(attemptState));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:RMStateStore.java

示例2: storeNewApplicationAttempt

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
/**
 * Non-blocking API
 * ResourceManager services call this to store state on an application attempt
 * This does not block the dispatcher threads
 * RMAppAttemptStoredEvent will be sent on completion to notify the RMAppAttempt
 */
public void storeNewApplicationAttempt(RMAppAttempt appAttempt) {
  Credentials credentials = getCredentialsFromAppAttempt(appAttempt);

  AggregateAppResourceUsage resUsage =
      appAttempt.getRMAppAttemptMetrics().getAggregateAppResourceUsage();
  ApplicationAttemptStateData attemptState =
      ApplicationAttemptStateData.newInstance(
          appAttempt.getAppAttemptId(),
          appAttempt.getMasterContainer(),
          credentials, appAttempt.getStartTime(),
          resUsage.getMemorySeconds(),
          resUsage.getVcoreSeconds());

  dispatcher.getEventHandler().handle(
    new RMStateStoreAppAttemptEvent(attemptState));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:RMStateStore.java

示例3: storeNewApplicationAttempt

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
/**
 * Non-blocking API
 * ResourceManager services call this to store state on an application attempt
 * This does not block the dispatcher threads
 * RMAppAttemptStoredEvent will be sent on completion to notify the RMAppAttempt
 */
public synchronized void storeNewApplicationAttempt(RMAppAttempt appAttempt) {
  Credentials credentials = getCredentialsFromAppAttempt(appAttempt);

  AggregateAppResourceUsage resUsage =
      appAttempt.getRMAppAttemptMetrics().getAggregateAppResourceUsage();
  ApplicationAttemptStateData attemptState =
      ApplicationAttemptStateData.newInstance(
          appAttempt.getAppAttemptId(),
          appAttempt.getMasterContainer(),
          credentials, appAttempt.getStartTime(),
          resUsage.getMemorySeconds(),
          resUsage.getVcoreSeconds());

  dispatcher.getEventHandler().handle(
    new RMStateStoreAppAttemptEvent(attemptState));
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:24,代码来源:RMStateStore.java

示例4: transition

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
@Override
public void transition(RMStateStore store, RMStateStoreEvent event) {
  if (!(event instanceof RMStateStoreAppAttemptEvent)) {
    // should never happen
    LOG.error("Illegal event type: " + event.getClass());
    return;
  }
  ApplicationAttemptState attemptState =
      ((RMStateStoreAppAttemptEvent) event).getAppAttemptState();
  try {
    ApplicationAttemptStateData attemptStateData = 
        ApplicationAttemptStateData.newInstance(attemptState);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Storing info for attempt: " + attemptState.getAttemptId());
    }
    store.storeApplicationAttemptStateInternal(attemptState.getAttemptId(),
        attemptStateData);
    store.notifyApplicationAttempt(new RMAppAttemptEvent
           (attemptState.getAttemptId(),
           RMAppAttemptEventType.ATTEMPT_NEW_SAVED));
  } catch (Exception e) {
    LOG.error("Error storing appAttempt: " + attemptState.getAttemptId(), e);
    store.notifyStoreOperationFailed(e);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:26,代码来源:RMStateStore.java

示例5: storeNewApplicationAttempt

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
/**
 * Non-blocking API
 * ResourceManager services call this to store state on an application attempt
 * This does not block the dispatcher threads
 * RMAppAttemptStoredEvent will be sent on completion to notify the RMAppAttempt
 */
public void storeNewApplicationAttempt(RMAppAttempt appAttempt) {
  Credentials credentials = getCredentialsFromAppAttempt(appAttempt);
  RMAppAttemptMetrics attempMetrics = appAttempt.getRMAppAttemptMetrics();
  AggregateAppResourceUsage resUsage =
      attempMetrics.getAggregateAppResourceUsage();
  ApplicationAttemptStateData attemptState =
      ApplicationAttemptStateData.newInstance(
          appAttempt.getAppAttemptId(),
          appAttempt.getMasterContainer(),
          credentials, appAttempt.getStartTime(),
          resUsage.getMemorySeconds(),
          resUsage.getVcoreSeconds(),
          resUsage.getGPUSeconds(),
          attempMetrics.getPreemptedMemory(),
          attempMetrics.getPreemptedVcore(),
          attempMetrics.getPreemptedGPU(),
          appAttempt.getTrackingUrl());

  dispatcher.getEventHandler().handle(
    new RMStateStoreAppAttemptEvent(attemptState));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:29,代码来源:RMStateStore.java

示例6: rememberTargetTransitionsAndStoreState

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
private void rememberTargetTransitionsAndStoreState(RMAppAttemptEvent event,
    Object transitionToDo, RMAppAttemptState targetFinalState,
    RMAppAttemptState stateToBeStored) {

  rememberTargetTransitions(event, transitionToDo, targetFinalState);
  stateBeforeFinalSaving = getState();

  // As of today, finalState, diagnostics, final-tracking-url and
  // finalAppStatus are the only things that we store into the StateStore
  // AFTER the initial saving on app-attempt-start
  // These fields can be visible from outside only after they are saved in
  // StateStore
  String diags = null;

  // don't leave the tracking URL pointing to a non-existent AM
  setTrackingUrlToRMAppPage(stateToBeStored);
  String finalTrackingUrl = getOriginalTrackingUrl();
  FinalApplicationStatus finalStatus = null;
  int exitStatus = ContainerExitStatus.INVALID;
  switch (event.getType()) {
  case LAUNCH_FAILED:
    RMAppAttemptLaunchFailedEvent launchFaileEvent =
        (RMAppAttemptLaunchFailedEvent) event;
    diags = launchFaileEvent.getMessage();
    break;
  case REGISTERED:
    diags = getUnexpectedAMRegisteredDiagnostics();
    break;
  case UNREGISTERED:
    RMAppAttemptUnregistrationEvent unregisterEvent =
        (RMAppAttemptUnregistrationEvent) event;
    diags = unregisterEvent.getDiagnostics();
    // reset finalTrackingUrl to url sent by am
    finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl());
    finalStatus = unregisterEvent.getFinalApplicationStatus();
    break;
  case CONTAINER_FINISHED:
    RMAppAttemptContainerFinishedEvent finishEvent =
        (RMAppAttemptContainerFinishedEvent) event;
    diags = getAMContainerCrashedDiagnostics(finishEvent);
    exitStatus = finishEvent.getContainerStatus().getExitStatus();
    break;
  case KILL:
    break;
  case EXPIRE:
    diags = getAMExpiredDiagnostics(event);
    break;
  default:
    break;
  }
  AggregateAppResourceUsage resUsage =
      this.attemptMetrics.getAggregateAppResourceUsage();
  RMStateStore rmStore = rmContext.getStateStore();
  setFinishTime(System.currentTimeMillis());

  ApplicationAttemptStateData attemptState =
      ApplicationAttemptStateData.newInstance(
          applicationAttemptId,  getMasterContainer(),
          rmStore.getCredentialsFromAppAttempt(this),
          startTime, stateToBeStored, finalTrackingUrl, diags,
          finalStatus, exitStatus,
        getFinishTime(), resUsage.getMemorySeconds(),
        resUsage.getVcoreSeconds(), resUsage.getGcoreSeconds());
  LOG.info("Updating application attempt " + applicationAttemptId
      + " with final state: " + targetedFinalState + ", and exit status: "
      + exitStatus);
  rmStore.updateApplicationAttemptState(attemptState);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:69,代码来源:RMAppAttemptImpl.java

示例7: rememberTargetTransitionsAndStoreState

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
private void rememberTargetTransitionsAndStoreState(RMAppAttemptEvent event,
    Object transitionToDo, RMAppAttemptState targetFinalState,
    RMAppAttemptState stateToBeStored) {

  rememberTargetTransitions(event, transitionToDo, targetFinalState);
  stateBeforeFinalSaving = getState();

  // As of today, finalState, diagnostics, final-tracking-url and
  // finalAppStatus are the only things that we store into the StateStore
  // AFTER the initial saving on app-attempt-start
  // These fields can be visible from outside only after they are saved in
  // StateStore
  String diags = null;

  // don't leave the tracking URL pointing to a non-existent AM
  setTrackingUrlToRMAppPage(stateToBeStored);
  String finalTrackingUrl = getOriginalTrackingUrl();
  FinalApplicationStatus finalStatus = null;
  int exitStatus = ContainerExitStatus.INVALID;
  switch (event.getType()) {
  case LAUNCH_FAILED:
    diags = event.getDiagnosticMsg();
    break;
  case REGISTERED:
    diags = getUnexpectedAMRegisteredDiagnostics();
    break;
  case UNREGISTERED:
    RMAppAttemptUnregistrationEvent unregisterEvent =
        (RMAppAttemptUnregistrationEvent) event;
    diags = unregisterEvent.getDiagnosticMsg();
    // reset finalTrackingUrl to url sent by am
    finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl());
    finalStatus = unregisterEvent.getFinalApplicationStatus();
    break;
  case CONTAINER_FINISHED:
    RMAppAttemptContainerFinishedEvent finishEvent =
        (RMAppAttemptContainerFinishedEvent) event;
    diags = getAMContainerCrashedDiagnostics(finishEvent);
    exitStatus = finishEvent.getContainerStatus().getExitStatus();
    break;
  case KILL:
    break;
  case FAIL:
    diags = event.getDiagnosticMsg();
    break;
  case EXPIRE:
    diags = getAMExpiredDiagnostics(event);
    break;
  default:
    break;
  }
  AggregateAppResourceUsage resUsage =
      this.attemptMetrics.getAggregateAppResourceUsage();
  RMStateStore rmStore = rmContext.getStateStore();
  setFinishTime(System.currentTimeMillis());

  ApplicationAttemptStateData attemptState =
      ApplicationAttemptStateData.newInstance(
          applicationAttemptId,  getMasterContainer(),
          rmStore.getCredentialsFromAppAttempt(this),
          startTime, stateToBeStored, finalTrackingUrl, diags,
          finalStatus, exitStatus,
        getFinishTime(), resUsage.getMemorySeconds(),
        resUsage.getVcoreSeconds());
  LOG.info("Updating application attempt " + applicationAttemptId
      + " with final state: " + targetedFinalState + ", and exit status: "
      + exitStatus);
  rmStore.updateApplicationAttemptState(attemptState);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:70,代码来源:RMAppAttemptImpl.java

示例8: rememberTargetTransitionsAndStoreState

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
private void rememberTargetTransitionsAndStoreState(RMAppAttemptEvent event,
    Object transitionToDo, RMAppAttemptState targetFinalState,
    RMAppAttemptState stateToBeStored) {

  rememberTargetTransitions(event, transitionToDo, targetFinalState);
  stateBeforeFinalSaving = getState();

  // As of today, finalState, diagnostics, final-tracking-url and
  // finalAppStatus are the only things that we store into the StateStore
  // AFTER the initial saving on app-attempt-start
  // These fields can be visible from outside only after they are saved in
  // StateStore
  String diags = null;

  // don't leave the tracking URL pointing to a non-existent AM
  setTrackingUrlToRMAppPage(stateToBeStored);
  String finalTrackingUrl = getOriginalTrackingUrl();
  FinalApplicationStatus finalStatus = null;
  int exitStatus = ContainerExitStatus.INVALID;
  switch (event.getType()) {
  case LAUNCH_FAILED:
    RMAppAttemptLaunchFailedEvent launchFaileEvent =
        (RMAppAttemptLaunchFailedEvent) event;
    diags = launchFaileEvent.getMessage();
    break;
  case REGISTERED:
    diags = getUnexpectedAMRegisteredDiagnostics();
    break;
  case UNREGISTERED:
    RMAppAttemptUnregistrationEvent unregisterEvent =
        (RMAppAttemptUnregistrationEvent) event;
    diags = unregisterEvent.getDiagnostics();
    // reset finalTrackingUrl to url sent by am
    finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl());
    finalStatus = unregisterEvent.getFinalApplicationStatus();
    break;
  case CONTAINER_FINISHED:
    RMAppAttemptContainerFinishedEvent finishEvent =
        (RMAppAttemptContainerFinishedEvent) event;
    diags = getAMContainerCrashedDiagnostics(finishEvent);
    exitStatus = finishEvent.getContainerStatus().getExitStatus();
    break;
  case KILL:
    break;
  case EXPIRE:
    diags = getAMExpiredDiagnostics(event);
    break;
  default:
    break;
  }
  AggregateAppResourceUsage resUsage =
      this.attemptMetrics.getAggregateAppResourceUsage();
  RMStateStore rmStore = rmContext.getStateStore();
  setFinishTime(System.currentTimeMillis());

  ApplicationAttemptStateData attemptState =
      ApplicationAttemptStateData.newInstance(
          applicationAttemptId,  getMasterContainer(),
          rmStore.getCredentialsFromAppAttempt(this),
          startTime, stateToBeStored, finalTrackingUrl, diags,
          finalStatus, exitStatus,
        getFinishTime(), resUsage.getMemorySeconds(),
        resUsage.getVcoreSeconds());
  LOG.info("Updating application attempt " + applicationAttemptId
      + " with final state: " + targetedFinalState + ", and exit status: "
      + exitStatus);
  rmStore.updateApplicationAttemptState(attemptState);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:69,代码来源:RMAppAttemptImpl.java

示例9: rememberTargetTransitionsAndStoreState

import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationAttemptStateData; //导入方法依赖的package包/类
private void rememberTargetTransitionsAndStoreState(RMAppAttemptEvent event,
    Object transitionToDo, RMAppAttemptState targetFinalState,
    RMAppAttemptState stateToBeStored) {

  rememberTargetTransitions(event, transitionToDo, targetFinalState);
  stateBeforeFinalSaving = getState();

  // As of today, finalState, diagnostics, final-tracking-url and
  // finalAppStatus are the only things that we store into the StateStore
  // AFTER the initial saving on app-attempt-start
  // These fields can be visible from outside only after they are saved in
  // StateStore
  String diags = null;

  // don't leave the tracking URL pointing to a non-existent AM
  if (conf.getBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED,
          YarnConfiguration.DEFAULT_APPLICATION_HISTORY_ENABLED)) {
    setTrackingUrlToAHSPage(stateToBeStored);
  } else {
    setTrackingUrlToRMAppPage(stateToBeStored);
  }
  String finalTrackingUrl = getOriginalTrackingUrl();
  FinalApplicationStatus finalStatus = null;
  int exitStatus = ContainerExitStatus.INVALID;
  switch (event.getType()) {
  case LAUNCH_FAILED:
    diags = event.getDiagnosticMsg();
    break;
  case REGISTERED:
    diags = getUnexpectedAMRegisteredDiagnostics();
    break;
  case UNREGISTERED:
    RMAppAttemptUnregistrationEvent unregisterEvent =
        (RMAppAttemptUnregistrationEvent) event;
    diags = unregisterEvent.getDiagnosticMsg();
    // reset finalTrackingUrl to url sent by am
    finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl());
    finalStatus = unregisterEvent.getFinalApplicationStatus();
    break;
  case CONTAINER_FINISHED:
    RMAppAttemptContainerFinishedEvent finishEvent =
        (RMAppAttemptContainerFinishedEvent) event;
    diags = getAMContainerCrashedDiagnostics(finishEvent);
    exitStatus = finishEvent.getContainerStatus().getExitStatus();
    break;
  case KILL:
    break;
  case FAIL:
    diags = event.getDiagnosticMsg();
    break;
  case EXPIRE:
    diags = getAMExpiredDiagnostics(event);
    break;
  default:
    break;
  }
  AggregateAppResourceUsage resUsage =
      this.attemptMetrics.getAggregateAppResourceUsage();
  RMStateStore rmStore = rmContext.getStateStore();
  setFinishTime(System.currentTimeMillis());

  ApplicationAttemptStateData attemptState =
      ApplicationAttemptStateData.newInstance(
          applicationAttemptId,  getMasterContainer(),
          rmStore.getCredentialsFromAppAttempt(this),
          startTime, stateToBeStored, finalTrackingUrl, diags,
          finalStatus, exitStatus,
        getFinishTime(), resUsage.getMemorySeconds(),
        resUsage.getVcoreSeconds(), resUsage.getGPUSeconds(),
        this.attemptMetrics.getPreemptedMemory(),
        this.attemptMetrics.getPreemptedVcore(),
        this.attemptMetrics.getPreemptedGPU(),
        getTrackingUrl());
  LOG.info("Updating application attempt " + applicationAttemptId
      + " with final state: " + targetedFinalState + ", and exit status: "
      + exitStatus);
  rmStore.updateApplicationAttemptState(attemptState);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:79,代码来源:RMAppAttemptImpl.java


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