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


Java StopContainersResponse.getFailedRequests方法代码示例

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


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

示例1: stopContainer

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
private void stopContainer(YarnRPC rpc, Token nmToken,
    List<ContainerId> containerId, ApplicationAttemptId appAttemptId,
    NodeId nodeId) throws Exception {
  StopContainersRequest request =
      StopContainersRequest.newInstance(containerId);
  ContainerManagementProtocol proxy = null;
  try {
    proxy =
        getContainerManagementProtocolProxy(rpc, nmToken, nodeId,
            appAttemptId.toString());
    StopContainersResponse response = proxy.stopContainers(request);
    if (response.getFailedRequests() != null &&
        response.getFailedRequests().containsKey(containerId)) {
      parseAndThrowException(response.getFailedRequests().get(containerId)
          .deSerialize());
    }
  } catch (Exception e) {
    if (proxy != null) {
      rpc.stopProxy(proxy, conf);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestContainerManagerSecurity.java

示例2: stopContainerInternal

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
private void stopContainerInternal(ContainerId containerId, NodeId nodeId)
    throws IOException, YarnException {
  ContainerManagementProtocolProxyData proxy = null;
  List<ContainerId> containerIds = new ArrayList<ContainerId>();
  containerIds.add(containerId);
  try {
    proxy = cmProxy.getProxy(nodeId.toString(), containerId);
    StopContainersResponse response =
        proxy.getContainerManagementProtocol().stopContainers(
          StopContainersRequest.newInstance(containerIds));
    if (response.getFailedRequests() != null
        && response.getFailedRequests().containsKey(containerId)) {
      Throwable t = response.getFailedRequests().get(containerId)
        .deSerialize();
      parseAndThrowException(t);
    }
  } finally {
    if (proxy != null) {
      cmProxy.mayBeCloseProxy(proxy);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:NMClientImpl.java

示例3: cleanup

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
private void cleanup() throws IOException, YarnException {
  connect();
  ContainerId containerId = masterContainer.getId();
  List<ContainerId> containerIds = new ArrayList<ContainerId>();
  containerIds.add(containerId);
  StopContainersRequest stopRequest =
      StopContainersRequest.newInstance(containerIds);
  StopContainersResponse response =
      containerMgrProxy.stopContainers(stopRequest);
  if (response.getFailedRequests() != null
      && response.getFailedRequests().containsKey(containerId)) {
    Throwable t = response.getFailedRequests().get(containerId).deSerialize();
    parseAndThrowException(t);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:AMLauncher.java

示例4: cleanup

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
private void cleanup() throws IOException, YarnException {
  connect();
  ContainerId containerId = masterContainer.getId();
  List<ContainerId> containerIds = new ArrayList<ContainerId>();
  containerIds.add(containerId);
  StopContainersRequest stopRequest =
      StopContainersRequest.newInstance(containerIds);
  StopContainersResponse response =
      containerMgrProxy.stopContainers(stopRequest);
  
  // The application is cleaned-up when completes successfully or killed
  // If the application failed more times than allowed, the cryptograhic
  // material is cleaned by RMAppImpl#AttemptFailedTransition
  if (conf.getBoolean(CommonConfigurationKeysPublic.IPC_SERVER_SSL_ENABLED,
      CommonConfigurationKeysPublic.IPC_SERVER_SSL_ENABLED_DEFAULT)) {
    // Remove the cryptographic material only if the application is
    // finished or killed
    RMApp app = rmContext.getRMApps().get(application.getAppAttemptId()
        .getApplicationId());
    if (appFinalStates.contains(app.getState())) {
      String user = rmContext.getRMApps().get(containerId
          .getApplicationAttemptId().getApplicationId()).getUser();
      try {
        rmContext.getCertificateLocalizationService().removeMaterial(user);
      } catch (InterruptedException | ExecutionException e) {
        throw new IOException(e);
      }
    }
  }
  
  if (response.getFailedRequests() != null
      && response.getFailedRequests().containsKey(containerId)) {
    Throwable t = response.getFailedRequests().get(containerId).deSerialize();
    parseAndThrowException(t);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:37,代码来源:AMLauncher.java

示例5: kill

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void kill() {

  if(this.state == ContainerState.PREP) {
    this.state = ContainerState.KILLED_BEFORE_LAUNCH;
  } else if (!isCompletelyDone()) {
    LOG.info("KILLING " + taskAttemptID);

    ContainerManagementProtocolProxyData proxy = null;
    try {
      proxy = getCMProxy(this.containerMgrAddress, this.containerID);

      // kill the remote container if already launched
      List<ContainerId> ids = new ArrayList<ContainerId>();
      ids.add(this.containerID);
      StopContainersRequest request = StopContainersRequest.newInstance(ids);
      StopContainersResponse response =
          proxy.getContainerManagementProtocol().stopContainers(request);
      if (response.getFailedRequests() != null
          && response.getFailedRequests().containsKey(this.containerID)) {
        throw response.getFailedRequests().get(this.containerID)
          .deSerialize();
      }
    } catch (Throwable t) {
      // ignore the cleanup failure
      String message = "cleanup failed for container "
          + this.containerID + " : "
          + StringUtils.stringifyException(t);
      context.getEventHandler()
          .handle(
              new TaskAttemptDiagnosticsUpdateEvent(this.taskAttemptID,
                  message));
      LOG.warn(message);
    } finally {
      if (proxy != null) {
        cmProxy.mayBeCloseProxy(proxy);
      }
    }
    this.state = ContainerState.DONE;
  }
  // after killing, send killed event to task attempt
  context.getEventHandler().handle(
      new TaskAttemptEvent(this.taskAttemptID,
          TaskAttemptEventType.TA_CONTAINER_CLEANED));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:46,代码来源:ContainerLauncherImpl.java

示例6: kill

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void kill() {

  if(this.state == ContainerState.PREP) {
	LOG.info("final state for killed container"+"KILLED BEFORE LAUNCH");
    this.state = ContainerState.KILLED_BEFORE_LAUNCH;
  } else if (!isCompletelyDone()) {
    LOG.info("KILLING " + taskAttemptID);

    ContainerManagementProtocolProxyData proxy = null;
    try {
      proxy = getCMProxy(this.containerMgrAddress, this.containerID);

      // kill the remote container if already launched
      List<ContainerId> ids = new ArrayList<ContainerId>();
      ids.add(this.containerID);
      StopContainersRequest request = StopContainersRequest.newInstance(ids);
      StopContainersResponse response =
          proxy.getContainerManagementProtocol().stopContainers(request);
      if (response.getFailedRequests() != null
          && response.getFailedRequests().containsKey(this.containerID)) {
        throw response.getFailedRequests().get(this.containerID)
          .deSerialize();
      }
    } catch (Throwable t) {
      // ignore the cleanup failure
      String message = "cleanup failed for container "
          + this.containerID + " : "
          + StringUtils.stringifyException(t);
      context.getEventHandler()
          .handle(
              new TaskAttemptDiagnosticsUpdateEvent(this.taskAttemptID,
                  message));
      LOG.warn(message);
    } finally {
      if (proxy != null) {
        cmProxy.mayBeCloseProxy(proxy);
      }
    }
    LOG.info("final state for killed container"+"DONE");
    this.state = ContainerState.DONE;
  }
  // after killing, send killed event to task attempt
  context.getEventHandler().handle(
      new TaskAttemptEvent(this.taskAttemptID,
          TaskAttemptEventType.TA_CONTAINER_CLEANED));
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:48,代码来源:ContainerLauncherImpl.java


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