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


Java NMContainerStatus.getContainerState方法代码示例

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


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

示例1: getNMContainerStatuses

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
private List<NMContainerStatus> getNMContainerStatuses() throws IOException {
  List<NMContainerStatus> containerStatuses =
      new ArrayList<NMContainerStatus>();
  for (Container container : this.context.getContainers().values()) {
    ContainerId containerId = container.getContainerId();
    ApplicationId applicationId = containerId.getApplicationAttemptId()
        .getApplicationId();
    if (!this.context.getApplications().containsKey(applicationId)) {
      context.getContainers().remove(containerId);
      continue;
    }
    NMContainerStatus status =
        container.getNMContainerStatus();
    containerStatuses.add(status);
    if (status.getContainerState() == ContainerState.COMPLETE) {
      // Adding to finished containers cache. Cache will keep it around at
      // least for #durationToTrackStoppedContainers duration. In the
      // subsequent call to stop container it will get removed from cache.
      addCompletedContainer(containerId);
    }
  }
  LOG.info("Sending out " + containerStatuses.size()
    + " NM container statuses: " + containerStatuses);
  return containerStatuses;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:NodeStatusUpdaterImpl.java

示例2: getNMContainerStatuses

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
private List<NMContainerStatus> getNMContainerStatuses() throws IOException {
  List<NMContainerStatus> containerStatuses =
      new ArrayList<NMContainerStatus>();
  for (Container container : this.context.getContainers().values()) {
    ContainerId containerId = container.getContainerId();
    ApplicationId applicationId = container.getContainerId()
        .getApplicationAttemptId().getApplicationId();
    if (!this.context.getApplications().containsKey(applicationId)) {
      context.getContainers().remove(containerId);
      continue;
    }
    NMContainerStatus status =
        container.getNMContainerStatus();
    containerStatuses.add(status);
    if (status.getContainerState() == ContainerState.COMPLETE) {
      // Adding to finished containers cache. Cache will keep it around at
      // least for #durationToTrackStoppedContainers duration. In the
      // subsequent call to stop container it will get removed from cache.
      addCompletedContainer(container.getContainerId());
    }
  }
  LOG.info("Sending out " + containerStatuses.size()
    + " NM container statuses: " + containerStatuses);
  return containerStatuses;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:26,代码来源:NodeStatusUpdaterImpl.java

示例3: handleNMContainerStatus

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
/**
 * Helper method to handle received ContainerStatus. If this corresponds to
 * the completion of a master-container of a managed AM,
 * we call the handler for RMAppAttemptContainerFinishedEvent.
 */
@SuppressWarnings("unchecked")
@VisibleForTesting
void handleNMContainerStatus(NMContainerStatus containerStatus, NodeId nodeId) {
  ApplicationAttemptId appAttemptId =
      containerStatus.getContainerId().getApplicationAttemptId();
  RMApp rmApp =
      rmContext.getRMApps().get(appAttemptId.getApplicationId());
  if (rmApp == null) {
    LOG.error("Received finished container : "
        + containerStatus.getContainerId()
        + " for unknown application " + appAttemptId.getApplicationId()
        + " Skipping.");
    return;
  }

  if (rmApp.getApplicationSubmissionContext().getUnmanagedAM()) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Ignoring container completion status for unmanaged AM "
          + rmApp.getApplicationId());
    }
    return;
  }

  RMAppAttempt rmAppAttempt = rmApp.getRMAppAttempt(appAttemptId);
  Container masterContainer = rmAppAttempt.getMasterContainer();
  if (masterContainer.getId().equals(containerStatus.getContainerId())
      && containerStatus.getContainerState() == ContainerState.COMPLETE) {
    ContainerStatus status =
        ContainerStatus.newInstance(containerStatus.getContainerId(),
          containerStatus.getContainerState(), containerStatus.getDiagnostics(),
          containerStatus.getContainerExitStatus());
    // sending master container finished event.
    RMAppAttemptContainerFinishedEvent evt =
        new RMAppAttemptContainerFinishedEvent(appAttemptId, status,
            nodeId);
    rmContext.getDispatcher().getEventHandler().handle(evt);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:44,代码来源:ResourceTrackerService.java

示例4: transition

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
@Override
public void transition(RMNodeImpl rmNode, RMNodeEvent event) {
  // Inform the scheduler
  RMNodeStartedEvent startEvent = (RMNodeStartedEvent) event;
  List<NMContainerStatus> containers = null;

  String host = rmNode.nodeId.getHost();
  if (rmNode.context.getInactiveRMNodes().containsKey(host)) {
    // Old node rejoining
    RMNode previouRMNode = rmNode.context.getInactiveRMNodes().get(host);
    rmNode.context.getInactiveRMNodes().remove(host);
    rmNode.updateMetricsForRejoinedNode(previouRMNode.getState());
  } else {
    // Increment activeNodes explicitly because this is a new node.
    ClusterMetrics.getMetrics().incrNumActiveNodes();
    containers = startEvent.getNMContainerStatuses();
    if (containers != null && !containers.isEmpty()) {
      for (NMContainerStatus container : containers) {
        if (container.getContainerState() == ContainerState.RUNNING) {
          rmNode.launchedContainers.add(container.getContainerId());
        }
      }
    }
  }
  
  if (null != startEvent.getRunningApplications()) {
    for (ApplicationId appId : startEvent.getRunningApplications()) {
      handleRunningAppOnNode(rmNode, rmNode.context, appId, rmNode.nodeId);
    }
  }

  rmNode.context.getDispatcher().getEventHandler()
    .handle(new NodeAddedSchedulerEvent(rmNode, containers));
  rmNode.context.getDispatcher().getEventHandler().handle(
    new NodesListManagerEvent(
        NodesListManagerEventType.NODE_USABLE, rmNode));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:RMNodeImpl.java

示例5: transition

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
@Override
public void transition(RMNodeImpl rmNode, RMNodeEvent event) {
  // Inform the scheduler
  RMNodeStartedEvent startEvent = (RMNodeStartedEvent) event;
  List<NMContainerStatus> containers = null;

  NodeId nodeId = rmNode.nodeId;
  if (rmNode.context.getInactiveRMNodes().containsKey(nodeId)) {
    // Old node rejoining
    RMNode previouRMNode = rmNode.context.getInactiveRMNodes().get(nodeId);
    rmNode.context.getInactiveRMNodes().remove(nodeId);
    rmNode.updateMetricsForRejoinedNode(previouRMNode.getState());
  } else {
    // Increment activeNodes explicitly because this is a new node.
    ClusterMetrics.getMetrics().incrNumActiveNodes();
    containers = startEvent.getNMContainerStatuses();
    if (containers != null && !containers.isEmpty()) {
      for (NMContainerStatus container : containers) {
        if (container.getContainerState() == ContainerState.RUNNING) {
          rmNode.launchedContainers.add(container.getContainerId());
        }
      }
    }
  }
  
  if (null != startEvent.getRunningApplications()) {
    for (ApplicationId appId : startEvent.getRunningApplications()) {
      handleRunningAppOnNode(rmNode, rmNode.context, appId, rmNode.nodeId);
    }
  }

  rmNode.context.getDispatcher().getEventHandler()
    .handle(new NodeAddedSchedulerEvent(rmNode, containers));
  rmNode.context.getDispatcher().getEventHandler().handle(
    new NodesListManagerEvent(
        NodesListManagerEventType.NODE_USABLE, rmNode));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:38,代码来源:RMNodeImpl.java

示例6: handleNMContainerStatus

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
/**
 * Helper method to handle received ContainerStatus. If this corresponds to
 * the completion of a master-container of a managed AM,
 * we call the handler for RMAppAttemptContainerFinishedEvent.
 */
@SuppressWarnings("unchecked")
@VisibleForTesting
void handleNMContainerStatus(NMContainerStatus containerStatus, NodeId nodeId) {
  ApplicationAttemptId appAttemptId =
      containerStatus.getContainerId().getApplicationAttemptId();
  RMApp rmApp =
      rmContext.getRMApps().get(appAttemptId.getApplicationId());
  if (rmApp == null) {
    LOG.error("Received finished container : "
        + containerStatus.getContainerId()
        + "for unknown application " + appAttemptId.getApplicationId()
        + " Skipping.");
    return;
  }

  if (rmApp.getApplicationSubmissionContext().getUnmanagedAM()) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Ignoring container completion status for unmanaged AM"
          + rmApp.getApplicationId());
    }
    return;
  }

  RMAppAttempt rmAppAttempt = rmApp.getRMAppAttempt(appAttemptId);
  Container masterContainer = rmAppAttempt.getMasterContainer();
  if (masterContainer.getId().equals(containerStatus.getContainerId())
      && containerStatus.getContainerState() == ContainerState.COMPLETE) {
    ContainerStatus status =
        ContainerStatus.newInstance(containerStatus.getContainerId(),
          containerStatus.getContainerState(), containerStatus.getDiagnostics(),
          containerStatus.getContainerExitStatus());
    // sending master container finished event.
    RMAppAttemptContainerFinishedEvent evt =
        new RMAppAttemptContainerFinishedEvent(appAttemptId, status,
            nodeId);
    rmContext.getDispatcher().getEventHandler().handle(evt);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:44,代码来源:ResourceTrackerService.java

示例7: updateNewNodeMetricsAndContainers

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
protected static List<NMContainerStatus> updateNewNodeMetricsAndContainers(
        RMNodeImpl rmNode, RMNodeStartedEvent startEvent) {
  List<NMContainerStatus> containers;
  ClusterMetrics.getMetrics().incrNumActiveNodes();
  containers = startEvent.getNMContainerStatuses();
  if (containers != null && !containers.isEmpty()) {
    for (NMContainerStatus container : containers) {
      if (container.getContainerState() == ContainerState.RUNNING) {
        rmNode.launchedContainers.add(container.getContainerId());
      }
    }
  }
  return containers;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:15,代码来源:RMNodeImpl.java

示例8: addNodeTransitionInternal

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
@Override
  protected void addNodeTransitionInternal(RMNodeImpl rmNode, RMNodeEvent event) {
    // Inform the scheduler
      RMNodeStartedEvent startEvent = (RMNodeStartedEvent) event;
      List<NMContainerStatus> containers = null;

      NodeId nodeId = rmNode.nodeId;
      RMNode previousRMNode =
          rmNode.context.getInactiveRMNodes().remove(nodeId);
      if (previousRMNode != null) {
        rmNode.updateMetricsForRejoinedNode(previousRMNode.getState());
      } else {
        NodeId unknownNodeId =
            NodesListManager.createUnknownNodeId(nodeId.getHost());
        previousRMNode =
            rmNode.context.getInactiveRMNodes().remove(unknownNodeId);
        if (previousRMNode != null) {
          ClusterMetrics.getMetrics().decrDecommisionedNMs();
        }
        // Increment activeNodes explicitly because this is a new node.
        ClusterMetrics.getMetrics().incrNumActiveNodes();
        containers = startEvent.getNMContainerStatuses();
        if (containers != null && !containers.isEmpty()) {
          for (NMContainerStatus container : containers) {
            if (container.getContainerState() == ContainerState.RUNNING) {
              rmNode.launchedContainers.add(container.getContainerId());
            }
          }
        }
      }

      if (null != startEvent.getRunningApplications()) {
        for (ApplicationId appId : startEvent.getRunningApplications()) {
          handleRunningAppOnNode(rmNode, rmNode.context, appId, rmNode.nodeId);
        }
      }

//    if (rmNode.context.isDistributed() && !rmNode.context.isLeader()) {
      //Add NodeAddedSchedulerEvent to TransactionState
      toCommit.addPendingEvent(PendingEvent.Type.NODE_ADDED,
              PendingEvent.Status.NEW);
//    } else {
//      rmNode.context.getDispatcher().getEventHandler()
//              .handle(new NodeAddedSchedulerEvent(rmNode, containers));
if(rmNode.context.isLeader()){
      rmNode.context.getDispatcher().getEventHandler().handle(
              new NodesListManagerEvent(
                      NodesListManagerEventType.NODE_USABLE, rmNode));
    }
  }
 
开发者ID:hopshadoop,项目名称:hops,代码行数:51,代码来源:RMNodeImplDist.java

示例9: addNodeTransitionInternal

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入方法依赖的package包/类
@Override
protected void addNodeTransitionInternal(RMNodeImpl rmNode, RMNodeEvent event) {
  // Inform the scheduler
    RMNodeStartedEvent startEvent = (RMNodeStartedEvent) event;
    List<NMContainerStatus> containers = null;

    NodeId nodeId = rmNode.nodeId;
    RMNode previousRMNode =
        rmNode.context.getInactiveRMNodes().remove(nodeId);
    if (previousRMNode != null) {
      rmNode.updateMetricsForRejoinedNode(previousRMNode.getState());
    } else {
      NodeId unknownNodeId =
          NodesListManager.createUnknownNodeId(nodeId.getHost());
      previousRMNode =
          rmNode.context.getInactiveRMNodes().remove(unknownNodeId);
      if (previousRMNode != null) {
        ClusterMetrics.getMetrics().decrDecommisionedNMs();
      }
      // Increment activeNodes explicitly because this is a new node.
      ClusterMetrics.getMetrics().incrNumActiveNodes();
      containers = startEvent.getNMContainerStatuses();
      if (containers != null && !containers.isEmpty()) {
        for (NMContainerStatus container : containers) {
          if (container.getContainerState() == ContainerState.RUNNING) {
            rmNode.launchedContainers.add(container.getContainerId());
          }
        }
      }
    }

    if (null != startEvent.getRunningApplications()) {
      for (ApplicationId appId : startEvent.getRunningApplications()) {
        handleRunningAppOnNode(rmNode, rmNode.context, appId, rmNode.nodeId);
      }
    }

    rmNode.context.getDispatcher().getEventHandler()
      .handle(new NodeAddedSchedulerEvent(rmNode, containers));
    rmNode.context.getDispatcher().getEventHandler().handle(
      new NodesListManagerEvent(
          NodesListManagerEventType.NODE_USABLE, rmNode));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:44,代码来源:RMNodeImplNotDist.java


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