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

Java RMNodeStatusEvent类代码示例

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

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



RMNodeStatusEvent类属于org.apache.hadoop.yarn.server.resourcemanager.rmnode包,在下文中一共展示了RMNodeStatusEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMockRMNodeStatusEvent

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
private RMNodeStatusEvent getMockRMNodeStatusEvent(
    List<ContainerStatus> containerStatus) {
  NodeHeartbeatResponse response = mock(NodeHeartbeatResponse.class);

  NodeHealthStatus healthStatus = mock(NodeHealthStatus.class);
  Boolean yes = new Boolean(true);
  doReturn(yes).when(healthStatus).getIsNodeHealthy();
  
  RMNodeStatusEvent event = mock(RMNodeStatusEvent.class);
  doReturn(healthStatus).when(event).getNodeHealthStatus();
  doReturn(response).when(event).getLatestResponse();
  doReturn(RMNodeEventType.STATUS_UPDATE).when(event).getType();
  if (containerStatus != null) {
    doReturn(containerStatus).when(event).getContainers();
  }
  return event;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:TestRMNodeTransitions.java


示例2: testIncrementNodeCapacityUnderCapacity

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test
public void testIncrementNodeCapacityUnderCapacity() throws Exception {
  resetNodeTotalCapability(nodeOne, 0, 0);
  resetNodeTotalCapability(nodeTwo, 2, 512);
  Offer offerOne = TestObjectFactory.getOffer("localhost-one", "slave-one", "mock", "offer-one", 1.0, 512.0);
  Offer offerTwo = TestObjectFactory.getOffer("localhost-two", "slave-two", "mock", "offer-two", 3.0, 1024.0);
  olManager.addOffers(offerOne);
  olManager.addOffers(offerTwo);
      
  RMNodeStatusEvent eventOne = getRMStatusEvent(nodeOne);
  handler.beforeRMNodeEventHandled(eventOne, context);
  RMNodeStatusEvent eventTwo = getRMStatusEvent(nodeTwo);
  handler.beforeRMNodeEventHandled(eventTwo, context);
  
  assertEquals(512, nodeOne.getTotalCapability().getMemory());
  assertEquals(1, nodeOne.getTotalCapability().getVirtualCores());
  assertEquals(1024, nodeTwo.getTotalCapability().getMemory());
  assertEquals(3, nodeTwo.getTotalCapability().getVirtualCores());
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:20,代码来源:NMHeartBeatHandlerTest.java


示例3: testIncrementNodeCapacityOverCapacity

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test
public void testIncrementNodeCapacityOverCapacity() throws Exception {
  resetNodeTotalCapability(nodeOne, 1, 512);
  resetNodeTotalCapability(nodeTwo, 2, 2048);
  
  //Test over memory upper limit
  Offer offerOne = TestObjectFactory.getOffer("localhost-one", "slave-one", "mock", "offer-one", 0.2, 3072.0);
  //Test over CPU cores upper limit
  Offer offerTwo = TestObjectFactory.getOffer("localhost-two", "slave-two", "mock", "offer-two", 8.0, 1024.0);
  olManager.addOffers(offerOne);
  olManager.addOffers(offerTwo);

  RMNodeStatusEvent eventOne = getRMStatusEvent(nodeOne);  
  handler.beforeRMNodeEventHandled(eventOne, context);
  RMNodeStatusEvent eventTwo = getRMStatusEvent(nodeTwo);
  handler.beforeRMNodeEventHandled(eventTwo, context);
  
  assertEquals(512, nodeOne.getTotalCapability().getMemory());
  assertEquals(1, nodeOne.getTotalCapability().getVirtualCores()); 
  assertEquals(2048, nodeTwo.getTotalCapability().getMemory());
  assertEquals(2, nodeTwo.getTotalCapability().getVirtualCores());
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:23,代码来源:NMHeartBeatHandlerTest.java


示例4: testNodesDefaultWithUnHealthyNode

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的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());
  node.handle(new RMNodeStatusEvent(nm3.getNodeId(), nodeHealth,
      new ArrayList<ContainerStatus>(), null, 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:naver,项目名称:hadoop,代码行数:37,代码来源:TestRMWebServicesNodes.java


示例5: getMockRMNodeStatusEvent

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
private RMNodeStatusEvent getMockRMNodeStatusEvent() {
  NodeHeartbeatResponse response = mock(NodeHeartbeatResponse.class);

  NodeHealthStatus healthStatus = mock(NodeHealthStatus.class);
  Boolean yes = new Boolean(true);
  doReturn(yes).when(healthStatus).getIsNodeHealthy();
  
  RMNodeStatusEvent event = mock(RMNodeStatusEvent.class);
  doReturn(healthStatus).when(event).getNodeHealthStatus();
  doReturn(response).when(event).getLatestResponse();
  doReturn(RMNodeEventType.STATUS_UPDATE).when(event).getType();
  return event;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestRMNodeTransitions.java


示例6: testExpiredContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test (timeout = 5000)
public void testExpiredContainer() {
  // Start the node
  node.handle(new RMNodeStartedEvent(null, null, null));
  verify(scheduler).handle(any(NodeAddedSchedulerEvent.class));
  
  // Expire a container
  ContainerId completedContainerId = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(0, 0), 0), 0);
  node.handle(new RMNodeCleanContainerEvent(null, completedContainerId));
  Assert.assertEquals(1, node.getContainersToCleanUp().size());
  
  // Now verify that scheduler isn't notified of an expired container
  // by checking number of 'completedContainers' it got in the previous event
  RMNodeStatusEvent statusEvent = getMockRMNodeStatusEvent();
  ContainerStatus containerStatus = mock(ContainerStatus.class);
  doReturn(completedContainerId).when(containerStatus).getContainerId();
  doReturn(Collections.singletonList(containerStatus)).
      when(statusEvent).getContainers();
  node.handle(statusEvent);
  /* Expect the scheduler call handle function 2 times
   * 1. RMNode status from new to Running, handle the add_node event
   * 2. handle the node update event
   */
  verify(scheduler,times(2)).handle(any(NodeUpdateSchedulerEvent.class));     
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TestRMNodeTransitions.java


示例7: testStatusChange

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test (timeout = 5000)
public void testStatusChange(){
  //Start the node
  node.handle(new RMNodeStartedEvent(null, null, null));
  //Add info to the queue first
  node.setNextHeartBeat(false);

  ContainerId completedContainerId1 = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(0, 0), 0), 0);
  ContainerId completedContainerId2 = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(1, 1), 1), 1);
      
  RMNodeStatusEvent statusEvent1 = getMockRMNodeStatusEvent();
  RMNodeStatusEvent statusEvent2 = getMockRMNodeStatusEvent();

  ContainerStatus containerStatus1 = mock(ContainerStatus.class);
  ContainerStatus containerStatus2 = mock(ContainerStatus.class);

  doReturn(completedContainerId1).when(containerStatus1).getContainerId();
  doReturn(Collections.singletonList(containerStatus1))
      .when(statusEvent1).getContainers();
   
  doReturn(completedContainerId2).when(containerStatus2).getContainerId();
  doReturn(Collections.singletonList(containerStatus2))
      .when(statusEvent2).getContainers();

  verify(scheduler,times(1)).handle(any(NodeUpdateSchedulerEvent.class)); 
  node.handle(statusEvent1);
  node.handle(statusEvent2);
  verify(scheduler,times(1)).handle(any(NodeUpdateSchedulerEvent.class));
  Assert.assertEquals(2, node.getQueueSize());
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE));
  Assert.assertEquals(0, node.getQueueSize());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:TestRMNodeTransitions.java


示例8: testUpdateHeartbeatResponseForCleanup

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test(timeout=20000)
public void testUpdateHeartbeatResponseForCleanup() {
  RMNodeImpl node = getRunningNode();
  NodeId nodeId = node.getNodeID();

  // Expire a container
ContainerId completedContainerId = BuilderUtils.newContainerId(
		BuilderUtils.newApplicationAttemptId(
				BuilderUtils.newApplicationId(0, 0), 0), 0);
  node.handle(new RMNodeCleanContainerEvent(nodeId, completedContainerId));
  Assert.assertEquals(1, node.getContainersToCleanUp().size());

  // Finish an application
  ApplicationId finishedAppId = BuilderUtils.newApplicationId(0, 1);
  node.handle(new RMNodeCleanAppEvent(nodeId, finishedAppId));
  Assert.assertEquals(1, node.getAppsToCleanup().size());

  // Verify status update does not clear containers/apps to cleanup
  // but updating heartbeat response for cleanup does
  RMNodeStatusEvent statusEvent = getMockRMNodeStatusEvent();
  node.handle(statusEvent);
  Assert.assertEquals(1, node.getContainersToCleanUp().size());
  Assert.assertEquals(1, node.getAppsToCleanup().size());
  NodeHeartbeatResponse hbrsp = Records.newRecord(NodeHeartbeatResponse.class);
  node.updateNodeHeartbeatResponseForCleanup(hbrsp);
  Assert.assertEquals(0, node.getContainersToCleanUp().size());
  Assert.assertEquals(0, node.getAppsToCleanup().size());
  Assert.assertEquals(1, hbrsp.getContainersToCleanup().size());
  Assert.assertEquals(completedContainerId, hbrsp.getContainersToCleanup().get(0));
  Assert.assertEquals(1, hbrsp.getApplicationsToCleanup().size());
  Assert.assertEquals(finishedAppId, hbrsp.getApplicationsToCleanup().get(0));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:TestRMNodeTransitions.java


示例9: getUnhealthyNode

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


示例10: testNodesDefaultWithUnHealthyNode

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的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


示例11: testNodesResourceUtilization

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的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


示例12: getMockRMNodeStatusEventWithRunningApps

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
private RMNodeStatusEvent getMockRMNodeStatusEventWithRunningApps() {
  NodeHeartbeatResponse response = mock(NodeHeartbeatResponse.class);

  NodeHealthStatus healthStatus = mock(NodeHealthStatus.class);
  Boolean yes = new Boolean(true);
  doReturn(yes).when(healthStatus).getIsNodeHealthy();

  RMNodeStatusEvent event = mock(RMNodeStatusEvent.class);
  doReturn(healthStatus).when(event).getNodeHealthStatus();
  doReturn(response).when(event).getLatestResponse();
  doReturn(RMNodeEventType.STATUS_UPDATE).when(event).getType();
  doReturn(getAppIdList()).when(event).getKeepAliveAppIds();
  return event;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:TestRMNodeTransitions.java


示例13: getMockRMNodeStatusEventWithoutRunningApps

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
private RMNodeStatusEvent getMockRMNodeStatusEventWithoutRunningApps() {
  NodeHeartbeatResponse response = mock(NodeHeartbeatResponse.class);

  NodeHealthStatus healthStatus = mock(NodeHealthStatus.class);
  Boolean yes = new Boolean(true);
  doReturn(yes).when(healthStatus).getIsNodeHealthy();

  RMNodeStatusEvent event = mock(RMNodeStatusEvent.class);
  doReturn(healthStatus).when(event).getNodeHealthStatus();
  doReturn(response).when(event).getLatestResponse();
  doReturn(RMNodeEventType.STATUS_UPDATE).when(event).getType();
  doReturn(null).when(event).getKeepAliveAppIds();
  return event;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:TestRMNodeTransitions.java


示例14: testExpiredContainer

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test (timeout = 5000)
public void testExpiredContainer() {
  // Start the node
  node.handle(new RMNodeStartedEvent(null, null, null));
  verify(scheduler).handle(any(NodeAddedSchedulerEvent.class));
  
  // Expire a container
  ContainerId completedContainerId = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(0, 0), 0), 0);
  node.handle(new RMNodeCleanContainerEvent(null, completedContainerId));
  Assert.assertEquals(1, node.getContainersToCleanUp().size());
  
  // Now verify that scheduler isn't notified of an expired container
  // by checking number of 'completedContainers' it got in the previous event
  RMNodeStatusEvent statusEvent = getMockRMNodeStatusEvent(null);
  ContainerStatus containerStatus = mock(ContainerStatus.class);
  doReturn(completedContainerId).when(containerStatus).getContainerId();
  doReturn(Collections.singletonList(containerStatus)).
      when(statusEvent).getContainers();
  node.handle(statusEvent);
  /* Expect the scheduler call handle function 2 times
   * 1. RMNode status from new to Running, handle the add_node event
   * 2. handle the node update event
   */
  verify(scheduler,times(2)).handle(any(NodeUpdateSchedulerEvent.class));     
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:28,代码来源:TestRMNodeTransitions.java


示例15: testStatusUpdateOnDecommissioningNode

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test
public void testStatusUpdateOnDecommissioningNode() {
  RMNodeImpl node = getDecommissioningNode();
  ClusterMetrics cm = ClusterMetrics.getMetrics();
  int initialActive = cm.getNumActiveNMs();
  int initialDecommissioning = cm.getNumDecommissioningNMs();
  int initialDecommissioned = cm.getNumDecommisionedNMs();
  Assert.assertEquals(NodeState.DECOMMISSIONING, node.getState());
  // Verify node in DECOMMISSIONING won't be changed by status update
  // with running apps
  RMNodeStatusEvent statusEvent = getMockRMNodeStatusEventWithRunningApps();
  node.handle(statusEvent);
  Assert.assertEquals(NodeState.DECOMMISSIONING, node.getState());
  Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
  Assert.assertEquals("Decommissioning Nodes", initialDecommissioning,
      cm.getNumDecommissioningNMs());
  Assert.assertEquals("Decommissioned Nodes", initialDecommissioned,
      cm.getNumDecommisionedNMs());

  // Verify node in DECOMMISSIONING will be changed by status update
  // without running apps
  statusEvent = getMockRMNodeStatusEventWithoutRunningApps();
  node.handle(statusEvent);
  Assert.assertEquals(NodeState.DECOMMISSIONED, node.getState());
  Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
  Assert.assertEquals("Decommissioning Nodes", initialDecommissioning - 1,
      cm.getNumDecommissioningNMs());
  Assert.assertEquals("Decommissioned Nodes", initialDecommissioned + 1,
      cm.getNumDecommisionedNMs());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:31,代码来源:TestRMNodeTransitions.java


示例16: testStatusChange

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test (timeout = 5000)
public void testStatusChange(){
  //Start the node
  node.handle(new RMNodeStartedEvent(null, null, null));
  //Add info to the queue first
  node.setNextHeartBeat(false);

  ContainerId completedContainerId1 = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(0, 0), 0), 0);
  ContainerId completedContainerId2 = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(1, 1), 1), 1);
      
  RMNodeStatusEvent statusEvent1 = getMockRMNodeStatusEvent(null);
  RMNodeStatusEvent statusEvent2 = getMockRMNodeStatusEvent(null);

  ContainerStatus containerStatus1 = mock(ContainerStatus.class);
  ContainerStatus containerStatus2 = mock(ContainerStatus.class);

  doReturn(completedContainerId1).when(containerStatus1).getContainerId();
  doReturn(Collections.singletonList(containerStatus1))
      .when(statusEvent1).getContainers();
   
  doReturn(completedContainerId2).when(containerStatus2).getContainerId();
  doReturn(Collections.singletonList(containerStatus2))
      .when(statusEvent2).getContainers();

  verify(scheduler,times(1)).handle(any(NodeUpdateSchedulerEvent.class)); 
  node.handle(statusEvent1);
  node.handle(statusEvent2);
  verify(scheduler,times(1)).handle(any(NodeUpdateSchedulerEvent.class));
  Assert.assertEquals(2, node.getQueueSize());
  node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE));
  Assert.assertEquals(0, node.getQueueSize());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:37,代码来源:TestRMNodeTransitions.java


示例17: testUpdateHeartbeatResponseForCleanup

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的package包/类
@Test(timeout=20000)
public void testUpdateHeartbeatResponseForCleanup() {
  RMNodeImpl node = getRunningNode();
  NodeId nodeId = node.getNodeID();

  // Expire a container
  ContainerId completedContainerId = BuilderUtils.newContainerId(
      BuilderUtils.newApplicationAttemptId(
          BuilderUtils.newApplicationId(0, 0), 0), 0);
  node.handle(new RMNodeCleanContainerEvent(nodeId, completedContainerId));
  Assert.assertEquals(1, node.getContainersToCleanUp().size());

  // Finish an application
  ApplicationId finishedAppId = BuilderUtils.newApplicationId(0, 1);
  node.handle(new RMNodeCleanAppEvent(nodeId, finishedAppId));
  Assert.assertEquals(1, node.getAppsToCleanup().size());

  // Verify status update does not clear containers/apps to cleanup
  // but updating heartbeat response for cleanup does
  RMNodeStatusEvent statusEvent = getMockRMNodeStatusEvent(null);
  node.handle(statusEvent);
  Assert.assertEquals(1, node.getContainersToCleanUp().size());
  Assert.assertEquals(1, node.getAppsToCleanup().size());
  NodeHeartbeatResponse hbrsp = Records.newRecord(NodeHeartbeatResponse.class);
  node.updateNodeHeartbeatResponseForCleanup(hbrsp);
  Assert.assertEquals(0, node.getContainersToCleanUp().size());
  Assert.assertEquals(0, node.getAppsToCleanup().size());
  Assert.assertEquals(1, hbrsp.getContainersToCleanup().size());
  Assert.assertEquals(completedContainerId, hbrsp.getContainersToCleanup().get(0));
  Assert.assertEquals(1, hbrsp.getApplicationsToCleanup().size());
  Assert.assertEquals(finishedAppId, hbrsp.getApplicationsToCleanup().get(0));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:TestRMNodeTransitions.java


示例18: testUpdateHeartbeatResponseForAppLifeCycle

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的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


示例19: getUnhealthyNode

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的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


示例20: testDecommissioningUnhealthy

import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; //导入依赖的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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Node类代码示例发布时间:2022-05-22
下一篇:
Java TrustedCertificateEntry类代码示例发布时间: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