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


Java StopContainersResponse.newInstance方法代码示例

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


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

示例1: stopContainers

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
/**
 * Stop a list of containers running on this NodeManager.
 */
@Override
public StopContainersResponse stopContainers(StopContainersRequest requests)
    throws YarnException, IOException {

  List<ContainerId> succeededRequests = new ArrayList<ContainerId>();
  Map<ContainerId, SerializedException> failedRequests =
      new HashMap<ContainerId, SerializedException>();
  UserGroupInformation remoteUgi = getRemoteUgi();
  NMTokenIdentifier identifier = selectNMTokenIdentifier(remoteUgi);
  for (ContainerId id : requests.getContainerIds()) {
    try {
      stopContainerInternal(identifier, id);
      succeededRequests.add(id);
    } catch (YarnException e) {
      failedRequests.put(id, SerializedException.newInstance(e));
    }
  }
  return StopContainersResponse
    .newInstance(succeededRequests, failedRequests);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:ContainerManagerImpl.java

示例2: stopContainers

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
/**
 * Stop a list of containers running on this NodeManager.
 */
@Override
public StopContainersResponse stopContainers(StopContainersRequest requests)
    throws YarnException, IOException {

  List<ContainerId> succeededRequests = new ArrayList<ContainerId>();
  Map<ContainerId, SerializedException> failedRequests =
      new HashMap<ContainerId, SerializedException>();
  UserGroupInformation remoteUgi = getRemoteUgi();
  NMTokenIdentifier identifier = selectNMTokenIdentifier(remoteUgi);
  if (identifier == null) {
    throw RPCUtil.getRemoteException(INVALID_NMTOKEN_MSG);
  }
  for (ContainerId id : requests.getContainerIds()) {
    try {
      stopContainerInternal(identifier, id);
      succeededRequests.add(id);
    } catch (YarnException e) {
      failedRequests.put(id, SerializedException.newInstance(e));
    }
  }
  return StopContainersResponse
    .newInstance(succeededRequests, failedRequests);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:ContainerManagerImpl.java

示例3: stopContainers

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
@Override
public StopContainersResponse stopContainers(StopContainersRequest request)
    throws YarnException, IOException {
  ContainersResponse containersResponse = containerManager
      .stopContainers(request.getContainerIds());
  return StopContainersResponse.newInstance(
      containersResponse.getSucceededContainers(),
      containersResponse.getFailedContainers());
}
 
开发者ID:intel-hpdd,项目名称:scheduling-connector-for-hadoop,代码行数:10,代码来源:HPCContainerManagementProtocolImpl.java

示例4: stopContainers

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
@Override
public StopContainersResponse stopContainers(StopContainersRequest request)
    throws YarnException {
  return StopContainersResponse.newInstance(null, null);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:TestAMAuthorization.java

示例5: stopContainers

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
@Override
synchronized public StopContainersResponse stopContainers(StopContainersRequest request) 
throws YarnException {
  for (ContainerId containerID : request.getContainerIds()) {
    String applicationId =
        String.valueOf(containerID.getApplicationAttemptId()
          .getApplicationId().getId());
    // Mark the container as COMPLETE
    List<Container> applicationContainers = containers.get(containerID.getApplicationAttemptId()
            .getApplicationId());
    for (Container c : applicationContainers) {
      if (c.getId().compareTo(containerID) == 0) {
        ContainerStatus containerStatus = containerStatusMap.get(c);
        containerStatus.setState(ContainerState.COMPLETE);
        containerStatusMap.put(c, containerStatus);
      }
    }

    // Send a heartbeat
    try {
      heartbeat();
    } catch (IOException ioe) {
      throw RPCUtil.getRemoteException(ioe);
    }

    // Remove container and update status
    int ctr = 0;
    Container container = null;
    for (Iterator<Container> i = applicationContainers.iterator(); i
      .hasNext();) {
      container = i.next();
      if (container.getId().compareTo(containerID) == 0) {
        i.remove();
        ++ctr;
      }
    }

    if (ctr != 1) {
      throw new IllegalStateException("Container " + containerID
          + " stopped " + ctr + " times!");
    }

    Resources.addTo(available, container.getResource());
    Resources.subtractFrom(used, container.getResource());

    if (LOG.isDebugEnabled()) {
      LOG.debug("stopContainer:" + " node=" + containerManagerAddress
          + " application=" + applicationId + " container=" + containerID
          + " available=" + available + " used=" + used);
    }
  }
  return StopContainersResponse.newInstance(null,null);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:54,代码来源:NodeManager.java

示例6: stopContainers

import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
@Override
synchronized public StopContainersResponse stopContainers(StopContainersRequest request) 
throws YarnException {
  for (ContainerId containerID : request.getContainerIds()) {
    String applicationId =
        String.valueOf(containerID.getApplicationAttemptId()
          .getApplicationId().getId());

    // Mark the container as COMPLETE
    List<Container> applicationContainers = containers.get(applicationId);
    for (Container c : applicationContainers) {
      if (c.getId().compareTo(containerID) == 0) {
        ContainerStatus containerStatus = containerStatusMap.get(c);
        containerStatus.setState(ContainerState.COMPLETE);
        containerStatusMap.put(c, containerStatus);
      }
    }

    // Send a heartbeat
    try {
      heartbeat();
    } catch (IOException ioe) {
      throw RPCUtil.getRemoteException(ioe);
    }

    // Remove container and update status
    int ctr = 0;
    Container container = null;
    for (Iterator<Container> i = applicationContainers.iterator(); i
      .hasNext();) {
      container = i.next();
      if (container.getId().compareTo(containerID) == 0) {
        i.remove();
        ++ctr;
      }
    }

    if (ctr != 1) {
      throw new IllegalStateException("Container " + containerID
          + " stopped " + ctr + " times!");
    }

    Resources.addTo(available, container.getResource());
    Resources.subtractFrom(used, container.getResource());

    if (LOG.isDebugEnabled()) {
      LOG.debug("stopContainer:" + " node=" + containerManagerAddress
          + " application=" + applicationId + " container=" + containerID
          + " available=" + available + " used=" + used);
    }
  }
  return StopContainersResponse.newInstance(null,null);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:54,代码来源:NodeManager.java


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