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


Java NodeStatus.newInstance方法代码示例

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


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

示例1: getNodeStatus

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
private NodeStatus getNodeStatus(int responseId) throws IOException {

    NodeHealthStatus nodeHealthStatus = this.context.getNodeHealthStatus();
    nodeHealthStatus.setHealthReport(healthChecker.getHealthReport());
    nodeHealthStatus.setIsNodeHealthy(healthChecker.isHealthy());
    nodeHealthStatus.setLastHealthReportTime(healthChecker
      .getLastHealthReportTime());
    if (LOG.isDebugEnabled()) {
      LOG.debug("Node's health-status : " + nodeHealthStatus.getIsNodeHealthy()
          + ", " + nodeHealthStatus.getHealthReport());
    }
    List<ContainerStatus> containersStatuses = getContainerStatuses();
    NodeStatus nodeStatus =
        NodeStatus.newInstance(nodeId, responseId, containersStatuses,
          createKeepAliveApplicationList(), nodeHealthStatus);

    return nodeStatus;
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:NodeStatusUpdaterImpl.java

示例2: testResourceTrackerOnHA

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null, null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null);
  resourceTracker.nodeHeartbeat(request2);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例3: getNodeStatus

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@VisibleForTesting
protected NodeStatus getNodeStatus(int responseId) throws IOException {

  NodeHealthStatus nodeHealthStatus = this.context.getNodeHealthStatus();
  nodeHealthStatus.setHealthReport(healthChecker.getHealthReport());
  nodeHealthStatus.setIsNodeHealthy(healthChecker.isHealthy());
  nodeHealthStatus.setLastHealthReportTime(healthChecker
    .getLastHealthReportTime());
  if (LOG.isDebugEnabled()) {
    LOG.debug("Node's health-status : " + nodeHealthStatus.getIsNodeHealthy()
        + ", " + nodeHealthStatus.getHealthReport());
  }
  List<ContainerStatus> containersStatuses = getContainerStatuses();
  ResourceUtilization containersUtilization = getContainersUtilization();
  ResourceUtilization nodeUtilization = getNodeUtilization();
  List<org.apache.hadoop.yarn.api.records.Container> increasedContainers
      = getIncreasedContainers();
  NodeStatus nodeStatus =
      NodeStatus.newInstance(nodeId, responseId, containersStatuses,
        createKeepAliveApplicationList(), nodeHealthStatus,
        containersUtilization, nodeUtilization, increasedContainers);

  return nodeStatus;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:NodeStatusUpdaterImpl.java

示例4: testResourceTrackerOnHA

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null, null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null, null, null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null,null);
  resourceTracker.nodeHeartbeat(request2);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例5: testResourceTrackerOnHA

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null, null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null);
  resourceTracker.nodeHeartbeat(request2);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例6: getNodeStatus

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
private NodeStatus getNodeStatus(int responseId) {

    NodeHealthStatus nodeHealthStatus = this.context.getNodeHealthStatus();
    nodeHealthStatus.setHealthReport(healthChecker.getHealthReport());
    nodeHealthStatus.setIsNodeHealthy(healthChecker.isHealthy());
    nodeHealthStatus.setLastHealthReportTime(healthChecker
      .getLastHealthReportTime());
    if (LOG.isDebugEnabled()) {
      LOG.debug("Node's health-status : " + nodeHealthStatus.getIsNodeHealthy()
          + ", " + nodeHealthStatus.getHealthReport());
    }
    List<ContainerStatus> containersStatuses = getContainerStatuses();
    if (LOG.isDebugEnabled()) {
      LOG.debug(this.nodeId + " sending out status for "
          + containersStatuses.size() + " containers");
    }
    NodeStatus nodeStatus =
        NodeStatus.newInstance(nodeId, responseId, containersStatuses,
          createKeepAliveApplicationList(), nodeHealthStatus);

    return nodeStatus;
  }
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:23,代码来源:NodeStatusUpdaterImpl.java

示例7: testResourceTrackerOnHA

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null);
  resourceTracker.nodeHeartbeat(request2);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例8: createNodeStatus

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
/**
 * Create a NodeStatus test vector.
 * @param nodeId Node identifier.
 * @param responseId Response identifier.
 * @param containerPMem Virtual memory of the container.
 * @param containerVMem Physical memory of the container.
 * @param containerCPU CPU percentage of the container.
 * @param nodePMem Physical memory of the node.
 * @param nodeVMem Virtual memory of the node.
 * @param nodeCPU CPU percentage of the node.
 */
private NodeStatus createNodeStatus(
    NodeId nodeId,
    int responseId,
    int containerPMem,
    int containerVMem,
    float containerCPU,
    int nodePMem,
    int nodeVMem,
    float nodeCPU) {

  // Fake node status with fake utilization
  ResourceUtilization containersUtilization =
      ResourceUtilization.newInstance(containerPMem, containerVMem,
          containerCPU);
  ResourceUtilization nodeUtilization =
      ResourceUtilization.newInstance(nodePMem, nodeVMem, nodeCPU);
  NodeStatus status = NodeStatus.newInstance(
      nodeId,
      responseId,
      new ArrayList<ContainerStatus>(),
      null,
      NodeHealthStatus.newInstance(true, null, 0),
      containersUtilization,
      nodeUtilization,
      null);

  return status;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:40,代码来源:TestMiniYarnClusterNodeUtilization.java

示例9: testNodesDefaultWithUnHealthyNode

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test
public void testNodesDefaultWithUnHealthyNode() throws JSONException,
    Exception {

  WebResource r = resource();
  MockNM nm1 = rm.registerNode("h1:1234", 5120);
  MockNM nm2 = rm.registerNode("h2:1235", 5121);
  rm.sendNodeStarted(nm1);
  rm.NMwaitForState(nm1.getNodeId(), NodeState.RUNNING);
  rm.NMwaitForState(nm2.getNodeId(), NodeState.NEW);

  MockNM nm3 = rm.registerNode("h3:1236", 5122);
  rm.NMwaitForState(nm3.getNodeId(), NodeState.NEW);
  rm.sendNodeStarted(nm3);
  rm.NMwaitForState(nm3.getNodeId(), NodeState.RUNNING);
  RMNodeImpl node = (RMNodeImpl) rm.getRMContext().getRMNodes()
      .get(nm3.getNodeId());
  NodeHealthStatus nodeHealth = NodeHealthStatus.newInstance(false,
      "test health report", System.currentTimeMillis());
  NodeStatus nodeStatus = NodeStatus.newInstance(nm3.getNodeId(), 1,
    new ArrayList<ContainerStatus>(), null, nodeHealth, null, null, null);
  node.handle(new RMNodeStatusEvent(nm3.getNodeId(), nodeStatus, null));
  rm.NMwaitForState(nm3.getNodeId(), NodeState.UNHEALTHY);

  ClientResponse response =
      r.path("ws").path("v1").path("cluster").path("nodes")
        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  JSONObject nodes = json.getJSONObject("nodes");
  assertEquals("incorrect number of elements", 1, nodes.length());
  JSONArray nodeArray = nodes.getJSONArray("node");
  // 3 nodes, including the unhealthy node and the new node.
  assertEquals("incorrect number of elements", 3, nodeArray.length());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:38,代码来源:TestRMWebServicesNodes.java

示例10: testNodesResourceUtilization

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test
public void testNodesResourceUtilization() throws JSONException, Exception {
  WebResource r = resource();
  MockNM nm1 = rm.registerNode("h1:1234", 5120);
  rm.sendNodeStarted(nm1);
  rm.NMwaitForState(nm1.getNodeId(), NodeState.RUNNING);

  RMNodeImpl node = (RMNodeImpl) rm.getRMContext().getRMNodes()
      .get(nm1.getNodeId());
  NodeHealthStatus nodeHealth = NodeHealthStatus.newInstance(true,
      "test health report", System.currentTimeMillis());
  ResourceUtilization nodeResource = ResourceUtilization.newInstance(4096, 0,
      (float) 10.5);
  ResourceUtilization containerResource = ResourceUtilization.newInstance(
      2048, 0, (float) 5.05);
  NodeStatus nodeStatus = NodeStatus.newInstance(nm1.getNodeId(), 0,
      new ArrayList<ContainerStatus>(), null, nodeHealth, containerResource,
      nodeResource, null);
  node.handle(new RMNodeStatusEvent(nm1.getNodeId(), nodeStatus, null));
  rm.NMwaitForState(nm1.getNodeId(), NodeState.RUNNING);

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("nodes").accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  JSONObject nodes = json.getJSONObject("nodes");
  assertEquals("incorrect number of elements", 1, nodes.length());
  JSONArray nodeArray = nodes.getJSONArray("node");
  assertEquals("incorrect number of elements", 1, nodeArray.length());
  JSONObject info = nodeArray.getJSONObject(0);

  // verify the resource utilization
  verifyNodeInfo(info, nm1);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:38,代码来源:TestRMWebServicesNodes.java

示例11: testUpdateHeartbeatResponseForAppLifeCycle

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test(timeout=20000)
public void testUpdateHeartbeatResponseForAppLifeCycle() {
  RMNodeImpl node = getRunningNode();
  NodeId nodeId = node.getNodeID();

  ApplicationId runningAppId = BuilderUtils.newApplicationId(0, 1);
  // Create a running container
  ContainerId runningContainerId = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
      runningAppId, 0), 0);

  ContainerStatus status = ContainerStatus.newInstance(runningContainerId,
      ContainerState.RUNNING, "", 0);
  List<ContainerStatus> statusList = new ArrayList<ContainerStatus>();
  statusList.add(status);
  NodeHealthStatus nodeHealth = NodeHealthStatus.newInstance(true,
      "", System.currentTimeMillis());
  NodeStatus nodeStatus = NodeStatus.newInstance(nodeId, 0, statusList, null,
      nodeHealth, null, null, null);
  node.handle(new RMNodeStatusEvent(nodeId, nodeStatus, null));

  Assert.assertEquals(1, node.getRunningApps().size());

  // Finish an application
  ApplicationId finishedAppId = runningAppId;
  node.handle(new RMNodeCleanAppEvent(nodeId, finishedAppId));
  Assert.assertEquals(1, node.getAppsToCleanup().size());
  Assert.assertEquals(0, node.getRunningApps().size());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:30,代码来源:TestRMNodeTransitions.java

示例12: getUnhealthyNode

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
private RMNodeImpl getUnhealthyNode() {
  RMNodeImpl node = getRunningNode();
  NodeHealthStatus status = NodeHealthStatus.newInstance(false, "sick",
      System.currentTimeMillis());
  NodeStatus nodeStatus = NodeStatus.newInstance(node.getNodeID(), 0,
    new ArrayList<ContainerStatus>(), null, status, null, null, null);
  node.handle(new RMNodeStatusEvent(node.getNodeID(), nodeStatus, null));
  Assert.assertEquals(NodeState.UNHEALTHY, node.getState());
  return node;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:11,代码来源:TestRMNodeTransitions.java

示例13: testDecommissioningUnhealthy

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test
public void testDecommissioningUnhealthy() {
  RMNodeImpl node = getDecommissioningNode();
  NodeHealthStatus status = NodeHealthStatus.newInstance(false, "sick",
      System.currentTimeMillis());
  NodeStatus nodeStatus = NodeStatus.newInstance(node.getNodeID(), 0,
      new ArrayList<ContainerStatus>(), null, status, null, null, null);
  node.handle(new RMNodeStatusEvent(node.getNodeID(), nodeStatus, null));
  Assert.assertEquals(NodeState.DECOMMISSIONING, node.getState());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:11,代码来源:TestRMNodeTransitions.java

示例14: testNodesDefaultWithUnHealthyNode

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test
public void testNodesDefaultWithUnHealthyNode() throws JSONException,
    Exception {

  WebResource r = resource();
  getRunningRMNode("h1", 1234, 5120);
  // h2 will be in NEW state
  getNewRMNode("h2", 1235, 5121);

  RMNode node3 = getRunningRMNode("h3", 1236, 5122);
  NodeId nodeId3 = node3.getNodeID();

  RMNode node = rm.getRMContext().getRMNodes().get(nodeId3);
  NodeHealthStatus nodeHealth = NodeHealthStatus.newInstance(false,
      "test health report", System.currentTimeMillis());
  NodeStatus nodeStatus = NodeStatus.newInstance(nodeId3, 1,
    new ArrayList<ContainerStatus>(), null, nodeHealth, null, null, null);
  ((RMNodeImpl) node)
      .handle(new RMNodeStatusEvent(nodeId3, nodeStatus, null));
  rm.waitForState(nodeId3, NodeState.UNHEALTHY);

  ClientResponse response =
      r.path("ws").path("v1").path("cluster").path("nodes")
        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  JSONObject nodes = json.getJSONObject("nodes");
  assertEquals("incorrect number of elements", 1, nodes.length());
  JSONArray nodeArray = nodes.getJSONArray("node");
  // 3 nodes, including the unhealthy node and the new node.
  assertEquals("incorrect number of elements", 3, nodeArray.length());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:35,代码来源:TestRMWebServicesNodes.java

示例15: testNodesResourceUtilization

import org.apache.hadoop.yarn.server.api.records.NodeStatus; //导入方法依赖的package包/类
@Test
public void testNodesResourceUtilization() throws JSONException, Exception {
  WebResource r = resource();
  RMNode rmnode1 = getRunningRMNode("h1", 1234, 5120);
  NodeId nodeId1 = rmnode1.getNodeID();

  RMNodeImpl node = (RMNodeImpl) rm.getRMContext().getRMNodes().get(nodeId1);
  NodeHealthStatus nodeHealth = NodeHealthStatus.newInstance(true,
      "test health report", System.currentTimeMillis());
  ResourceUtilization nodeResource = ResourceUtilization.newInstance(4096, 0,
      (float) 10.5);
  ResourceUtilization containerResource = ResourceUtilization.newInstance(
      2048, 0, (float) 5.05);
  NodeStatus nodeStatus =
      NodeStatus.newInstance(nodeId1, 0,
      new ArrayList<ContainerStatus>(), null, nodeHealth, containerResource,
      nodeResource, null);
  node.handle(new RMNodeStatusEvent(nodeId1, nodeStatus, null));
  rm.waitForState(nodeId1, NodeState.RUNNING);

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("nodes").accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  JSONObject nodes = json.getJSONObject("nodes");
  assertEquals("incorrect number of elements", 1, nodes.length());
  JSONArray nodeArray = nodes.getJSONArray("node");
  assertEquals("incorrect number of elements", 1, nodeArray.length());
  JSONObject info = nodeArray.getJSONObject(0);

  // verify the resource utilization
  verifyNodeInfo(info, rmnode1);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:37,代码来源:TestRMWebServicesNodes.java


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