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


Java ContainerStatus.getState方法代码示例

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


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

示例1: testGetContainerStatus

import org.apache.hadoop.yarn.api.records.ContainerStatus; //导入方法依赖的package包/类
private void testGetContainerStatus(Container container, int index,
    ContainerState state, String diagnostics, List<Integer> exitStatuses)
        throws YarnException, IOException {
  while (true) {
    try {
      ContainerStatus status = nmClient.getContainerStatus(
          container.getId(), container.getNodeId());
      // NodeManager may still need some time to get the stable
      // container status
      if (status.getState() == state) {
        assertEquals(container.getId(), status.getContainerId());
        assertTrue("" + index + ": " + status.getDiagnostics(),
            status.getDiagnostics().contains(diagnostics));
        
        assertTrue("Exit Statuses are supposed to be in: " + exitStatuses +
            ", but the actual exit status code is: " + status.getExitStatus(),
            exitStatuses.contains(status.getExitStatus()));
        break;
      }
      Thread.sleep(100);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestNMClient.java

示例2: handleContainerStatus

import org.apache.hadoop.yarn.api.records.ContainerStatus; //导入方法依赖的package包/类
private void handleContainerStatus(List<ContainerStatus> containerStatuses) {
  // Filter the map to only obtain just launched containers and finished
  // containers.
  List<ContainerStatus> newlyLaunchedContainers =
      new ArrayList<ContainerStatus>();
  List<ContainerStatus> completedContainers =
      new ArrayList<ContainerStatus>();
  for (ContainerStatus remoteContainer : containerStatuses) {
    ContainerId containerId = remoteContainer.getContainerId();

    // Don't bother with containers already scheduled for cleanup, or for
    // applications already killed. The scheduler doens't need to know any
    // more about this container
    if (containersToClean.contains(containerId)) {
      LOG.info("Container " + containerId + " already scheduled for "
          + "cleanup, no further processing");
      continue;
    }
    if (finishedApplications.contains(containerId.getApplicationAttemptId()
        .getApplicationId())) {
      LOG.info("Container " + containerId
          + " belongs to an application that is already killed,"
          + " no further processing");
      continue;
    }

    // Process running containers
    if (remoteContainer.getState() == ContainerState.RUNNING) {
      if (!launchedContainers.contains(containerId)) {
        // Just launched container. RM knows about it the first time.
        launchedContainers.add(containerId);
        newlyLaunchedContainers.add(remoteContainer);
      }
    } else {
      // A finished container
      launchedContainers.remove(containerId);
      completedContainers.add(remoteContainer);
    }
  }
  if (newlyLaunchedContainers.size() != 0 || completedContainers.size() != 0) {
    nodeUpdateQueue.add(new UpdatedContainerInfo(newlyLaunchedContainers,
        completedContainers));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:45,代码来源:RMNodeImpl.java


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