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


Java RMNode.getLastHealthReportTime方法代码示例

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


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

示例1: NodeInfo

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; //导入方法依赖的package包/类
public NodeInfo(RMNode ni, ResourceScheduler sched) {
  NodeId id = ni.getNodeID();
  SchedulerNodeReport report = sched.getNodeReport(id);
  this.numContainers = 0;
  this.usedMemoryMB = 0;
  this.availMemoryMB = 0;
  if (report != null) {
    this.numContainers = report.getNumContainers();
    this.usedMemoryMB = report.getUsedResource().getMemory();
    this.availMemoryMB = report.getAvailableResource().getMemory();
    this.usedVirtualCores = report.getUsedResource().getVirtualCores();
    this.availableVirtualCores = report.getAvailableResource().getVirtualCores();
    this.usedGpuCores = report.getUsedResource().getGpuCores();
    this.availableGpuCores = report.getAvailableResource().getGpuCores();
  }
  this.id = id.toString();
  this.rack = ni.getRackName();
  this.nodeHostName = ni.getHostName();
  this.state = ni.getState();
  this.nodeHTTPAddress = ni.getHttpAddress();
  this.lastHealthUpdate = ni.getLastHealthReportTime();
  this.healthReport = String.valueOf(ni.getHealthReport());
  this.version = ni.getNodeManagerVersion();
  
  // add labels
  Set<String> labelSet = ni.getNodeLabels();
  if (labelSet != null) {
    nodeLabels.addAll(labelSet);
    Collections.sort(nodeLabels);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:NodeInfo.java

示例2: verifyNodeInfoGeneric

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; //导入方法依赖的package包/类
public void verifyNodeInfoGeneric(MockNM nm, String state, String rack,
    String id, String nodeHostName,
    String nodeHTTPAddress, long lastHealthUpdate, String healthReport,
    int numContainers, long usedMemoryMB, long availMemoryMB, long usedVirtualCores, 
    long availVirtualCores, long usedGpuCores, long availGpuCores, String version)
    throws JSONException, Exception {

  RMNode node = rm.getRMContext().getRMNodes().get(nm.getNodeId());
  ResourceScheduler sched = rm.getResourceScheduler();
  SchedulerNodeReport report = sched.getNodeReport(nm.getNodeId());

  WebServicesTestUtils.checkStringMatch("state", node.getState().toString(),
      state);
  WebServicesTestUtils.checkStringMatch("rack", node.getRackName(), rack);
  WebServicesTestUtils.checkStringMatch("id", nm.getNodeId().toString(), id);
  WebServicesTestUtils.checkStringMatch("nodeHostName", nm.getNodeId()
      .getHost(), nodeHostName);
  WebServicesTestUtils.checkStringMatch("healthReport",
      String.valueOf(node.getHealthReport()), healthReport);
  String expectedHttpAddress = nm.getNodeId().getHost() + ":"
      + nm.getHttpPort();
  WebServicesTestUtils.checkStringMatch("nodeHTTPAddress",
      expectedHttpAddress, nodeHTTPAddress);
  WebServicesTestUtils.checkStringMatch("version",
      node.getNodeManagerVersion(), version);

  long expectedHealthUpdate = node.getLastHealthReportTime();
  assertEquals("lastHealthUpdate doesn't match, got: " + lastHealthUpdate
      + " expected: " + expectedHealthUpdate, expectedHealthUpdate,
      lastHealthUpdate);

  if (report != null) {
    assertEquals("numContainers doesn't match: " + numContainers,
        report.getNumContainers(), numContainers);
    assertEquals("usedMemoryMB doesn't match: " + usedMemoryMB, report
        .getUsedResource().getMemory(), usedMemoryMB);
    assertEquals("availMemoryMB doesn't match: " + availMemoryMB, report
        .getAvailableResource().getMemory(), availMemoryMB);
    assertEquals("usedVirtualCores doesn't match: " + usedVirtualCores, report
        .getUsedResource().getVirtualCores(), usedVirtualCores);
    assertEquals("availVirtualCores doesn't match: " + availVirtualCores, report
        .getAvailableResource().getVirtualCores(), availVirtualCores);
    assertEquals("usedGpuCores doesn't match: " + usedGpuCores, report
        .getUsedResource().getGpuCores(), usedGpuCores);
    assertEquals("availGpuCores doesn't match: " + availGpuCores, report
        .getAvailableResource().getGpuCores(), availGpuCores);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:49,代码来源:TestRMWebServicesNodes.java


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