• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NMContainerStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



NMContainerStatus类属于org.apache.hadoop.yarn.server.api.protocolrecords包,在下文中一共展示了NMContainerStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: createNMContainerStatusForApp

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
public static List<NMContainerStatus>
    createNMContainerStatusForApp(MockAM am) {
  List<NMContainerStatus> list =
      new ArrayList<NMContainerStatus>();
  NMContainerStatus amContainer =
      TestRMRestart.createNMContainerStatus(am.getApplicationAttemptId(), 1,
        ContainerState.RUNNING);
  NMContainerStatus runningContainer =
      TestRMRestart.createNMContainerStatus(am.getApplicationAttemptId(), 2,
        ContainerState.RUNNING);
  NMContainerStatus completedContainer =
      TestRMRestart.createNMContainerStatus(am.getApplicationAttemptId(), 3,
        ContainerState.COMPLETE);
  list.add(amContainer);
  list.add(runningContainer);
  list.add(completedContainer);
  return list;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestWorkPreservingRMRestart.java


示例3: registerNode

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
public RegisterNodeManagerResponse registerNode(
    List<NMContainerStatus> containerReports,
    List<ApplicationId> runningApplications) throws Exception {
  RegisterNodeManagerRequest req = Records.newRecord(
      RegisterNodeManagerRequest.class);
  req.setNodeId(nodeId);
  req.setHttpPort(httpPort);
  Resource resource = BuilderUtils.newResource(memory, vCores, gCores);
  req.setResource(resource);
  req.setContainerStatuses(containerReports);
  req.setNMVersion(version);
  req.setRunningApplications(runningApplications);
  RegisterNodeManagerResponse registrationResponse =
      resourceTracker.registerNodeManager(req);
  this.currentContainerTokenMasterKey =
      registrationResponse.getContainerTokenMasterKey();
  this.currentNMTokenMasterKey = registrationResponse.getNMTokenMasterKey();
  return registrationResponse;    
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:MockNM.java


示例4: addNode

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
private synchronized void addNode(List<NMContainerStatus> containerReports,
    RMNode node) {
  FSSchedulerNode schedulerNode = new FSSchedulerNode(node, usePortForNodeName);
  nodes.put(node.getNodeID(), schedulerNode);
  String rackName = node.getRackName() == null ? "NULL" : node.getRackName();
  if (nodesPerRack.containsKey(rackName)) {
    nodesPerRack.put(rackName, nodesPerRack.get(rackName) + 1);
  } else {
    nodesPerRack.put(rackName, 1);
  }
  Resources.addTo(clusterResource, node.getTotalCapability());
  updateMaximumAllocation(schedulerNode, true);

  triggerUpdate();

  queueMgr.getRootQueue().setSteadyFairShare(clusterResource);
  queueMgr.getRootQueue().recomputeSteadyShares();
  LOG.info("Added node " + node.getNodeAddress() +
      " cluster capacity: " + clusterResource);

  recoverContainersOnNode(containerReports, node);
  updateRootQueueMetrics();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:FairScheduler.java


示例5: registerNode

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
public RegisterNodeManagerResponse registerNode(
    List<NMContainerStatus> containerReports,
    List<ApplicationId> runningApplications) throws Exception {
  RegisterNodeManagerRequest req = Records.newRecord(
      RegisterNodeManagerRequest.class);
  req.setNodeId(nodeId);
  req.setHttpPort(httpPort);
  Resource resource = BuilderUtils.newResource(memory, vCores);
  req.setResource(resource);
  req.setContainerStatuses(containerReports);
  req.setNMVersion(version);
  req.setRunningApplications(runningApplications);
  RegisterNodeManagerResponse registrationResponse =
      resourceTracker.registerNodeManager(req);
  this.currentContainerTokenMasterKey =
      registrationResponse.getContainerTokenMasterKey();
  this.currentNMTokenMasterKey = registrationResponse.getNMTokenMasterKey();
  return registrationResponse;    
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:MockNM.java


示例6: 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


示例7: addNode

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
private synchronized void addNode(List<NMContainerStatus> containerReports,
    RMNode node) {
  FSSchedulerNode schedulerNode = new FSSchedulerNode(node, usePortForNodeName);
  nodes.put(node.getNodeID(), schedulerNode);
  String rackName = node.getRackName() == null ? "NULL" : node.getRackName();
  if (nodesPerRack.containsKey(rackName)) {
    nodesPerRack.put(rackName, nodesPerRack.get(rackName) + 1);
  } else {
    nodesPerRack.put(rackName, 1);
  }
  Resources.addTo(clusterResource, schedulerNode.getTotalResource());
  updateMaximumAllocation(schedulerNode, true);

  triggerUpdate();

  queueMgr.getRootQueue().setSteadyFairShare(clusterResource);
  queueMgr.getRootQueue().recomputeSteadyShares();
  LOG.info("Added node " + node.getNodeAddress() +
      " cluster capacity: " + clusterResource);

  recoverContainersOnNode(containerReports, node);
  updateRootQueueMetrics();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:24,代码来源:FairScheduler.java


示例8: addNMContainerStatusesToProto

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
private synchronized void addNMContainerStatusesToProto() {
  maybeInitBuilder();
  builder.clearContainerStatuses();
  List<NMContainerStatusProto> list =
      new ArrayList<NMContainerStatusProto>();
  for (NMContainerStatus status : this.containerStatuses) {
    list.add(convertToProtoFormat(status));
  }
  builder.addAllContainerStatuses(list);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:RegisterNodeManagerRequestPBImpl.java


示例9: initContainerRecoveryReports

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
private void initContainerRecoveryReports() {
  if (this.containerStatuses != null) {
    return;
  }
  RegisterNodeManagerRequestProtoOrBuilder p = viaProto ? proto : builder;
  List<NMContainerStatusProto> list = p.getContainerStatusesList();
  this.containerStatuses = new ArrayList<NMContainerStatus>();
  for (NMContainerStatusProto c : list) {
    this.containerStatuses.add(convertFromProtoFormat(c));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:RegisterNodeManagerRequestPBImpl.java


示例10: setContainerStatuses

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
@Override
public void setContainerStatuses(
    List<NMContainerStatus> containerReports) {
  if (containerReports == null) {
    return;
  }
  initContainerRecoveryReports();
  this.containerStatuses.addAll(containerReports);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:RegisterNodeManagerRequestPBImpl.java


示例11: getNMContainerStatus

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
@Override
public NMContainerStatus getNMContainerStatus() {
  this.readLock.lock();
  try {
    return NMContainerStatus.newInstance(this.containerId, getCurrentState(),
      getResource(), diagnostics.toString(), exitCode,
      containerTokenIdentifier.getPriority(),
      containerTokenIdentifier.getCreationTime());
  } finally {
    this.readLock.unlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:ContainerImpl.java


示例12: createNMContainerStatus

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
public static NMContainerStatus createNMContainerStatus(int id,
    ContainerState containerState) {
  ApplicationId applicationId = ApplicationId.newInstance(0, 1);
  ApplicationAttemptId applicationAttemptId =
      ApplicationAttemptId.newInstance(applicationId, 1);
  ContainerId containerId = ContainerId.newContainerId(applicationAttemptId, id);
  NMContainerStatus containerReport =
      NMContainerStatus.newInstance(containerId, containerState,
        Resource.newInstance(1024, 1), "recover container", 0,
        Priority.newInstance(10), 0);
  return containerReport;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:TestNodeManagerResync.java


示例13: 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


示例14: transition

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
@Override
public RMContainerState transition(RMContainerImpl container,
    RMContainerEvent event) {
  NMContainerStatus report =
      ((RMContainerRecoverEvent) event).getContainerReport();
  if (report.getContainerState().equals(ContainerState.COMPLETE)) {
    ContainerStatus status =
        ContainerStatus.newInstance(report.getContainerId(),
          report.getContainerState(), report.getDiagnostics(),
          report.getContainerExitStatus());

    new FinishedTransition().transition(container,
      new RMContainerFinishedEvent(container.containerId, status,
        RMContainerEventType.FINISHED));
    return RMContainerState.COMPLETED;
  } else if (report.getContainerState().equals(ContainerState.RUNNING)) {
    // Tell the app
    container.eventHandler.handle(new RMAppRunningOnNodeEvent(container
        .getApplicationAttemptId().getApplicationId(), container.nodeId));
    return RMContainerState.RUNNING;
  } else {
    // This can never happen.
    LOG.warn("RMContainer received unexpected recover event with container"
        + " state " + report.getContainerState() + " while recovering.");
    return RMContainerState.RUNNING;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:RMContainerImpl.java


示例15: RMNodeStartedEvent

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
public RMNodeStartedEvent(NodeId nodeId,
    List<NMContainerStatus> containerReports,
    List<ApplicationId> runningApplications) {
  super(nodeId, RMNodeEventType.STARTED);
  this.containerStatuses = containerReports;
  this.runningApplications = runningApplications;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:RMNodeStartedEvent.java


示例16: 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


示例17: handleNMContainerStatus

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
private void handleNMContainerStatus(
    List<NMContainerStatus> nmContainerStatuses, RMNodeImpl rmnode) {
  List<ContainerStatus> containerStatuses =
      new ArrayList<ContainerStatus>();
  for (NMContainerStatus nmContainerStatus : nmContainerStatuses) {
    containerStatuses.add(createContainerStatus(nmContainerStatus));
  }
  rmnode.handleContainerStatus(containerStatuses);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:RMNodeImpl.java


示例18: createContainerStatus

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
private ContainerStatus createContainerStatus(
    NMContainerStatus remoteContainer) {
  ContainerStatus cStatus =
      ContainerStatus.newInstance(remoteContainer.getContainerId(),
          remoteContainer.getContainerState(),
          remoteContainer.getDiagnostics(),
          remoteContainer.getContainerExitStatus());
  return cStatus;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:RMNodeImpl.java


示例19: RMNodeReconnectEvent

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
public RMNodeReconnectEvent(NodeId nodeId, RMNode newNode,
    List<ApplicationId> runningApps, List<NMContainerStatus> containerReports) {
  super(nodeId, RMNodeEventType.RECONNECTED);
  reconnectedNode = newNode;
  runningApplications = runningApps;
  containerStatuses = containerReports;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:RMNodeReconnectEvent.java


示例20: killOrphanContainerOnNode

import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; //导入依赖的package包/类
private void killOrphanContainerOnNode(RMNode node,
    NMContainerStatus container) {
  if (!container.getContainerState().equals(ContainerState.COMPLETE)) {
    this.rmContext.getDispatcher().getEventHandler().handle(
      new RMNodeCleanContainerEvent(node.getNodeID(),
        container.getContainerId()));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:AbstractYarnScheduler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SinchClient类代码示例发布时间:2022-05-22
下一篇:
Java BaseShaderProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap