本文整理汇总了Java中org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java NodeHeartbeatRequest.newInstance方法的具体用法?Java NodeHeartbeatRequest.newInstance怎么用?Java NodeHeartbeatRequest.newInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest
的用法示例。
在下文中一共展示了NodeHeartbeatRequest.newInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testResourceTrackerOnHA
import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入方法依赖的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);
}
示例2: testResourceTrackerOnHA
import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入方法依赖的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);
}
示例3: testResourceTrackerOnHA
import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入方法依赖的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);
}
示例4: testResourceTrackerOnHA
import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入方法依赖的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);
}
示例5: testUpdateNodeUtilization
import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入方法依赖的package包/类
/**
* Simulates a NM heartbeat using the simulated NodeStatus fixture. Verify
* both the RMNode and SchedulerNode have been updated with the new
* utilization.
*/
@Test(timeout=60000)
public void testUpdateNodeUtilization()
throws InterruptedException, IOException, YarnException {
assertTrue("NMs fail to connect to the RM",
cluster.waitForNodeManagersToConnect(10000));
// Simulate heartbeat using NodeStatus fixture
NodeHeartbeatRequest request =
NodeHeartbeatRequest.newInstance(nodeStatus, null, null, null);
ResourceTracker tracker =
ServerRMProxy.createRMProxy(conf, ResourceTracker.class);
tracker.nodeHeartbeat(request);
// Give the heartbeat time to propagate to the RM
verifySimulatedUtilization();
// Alter utilization
int responseId = 10;
nodeStatus = createNodeStatus(nm.getNMContext().getNodeId(), responseId,
CONTAINER_PMEM_2, CONTAINER_VMEM_2, CONTAINER_CPU_2,
NODE_PMEM_2, NODE_VMEM_2, NODE_CPU_2);
nm.setNodeStatus(nodeStatus);
tracker.nodeHeartbeat(request);
// Give the heartbeat time to propagate to the RM
verifySimulatedUtilization();
}
示例6: testUpdateNodeUtilization
import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入方法依赖的package包/类
/**
* Simulates a NM heartbeat using the simulated NodeStatus fixture. Verify
* both the RMNode and SchedulerNode have been updated with the new
* utilization.
*/
@Test(timeout=60000)
public void testUpdateNodeUtilization()
throws InterruptedException, IOException, YarnException {
assertTrue("NMs fail to connect to the RM",
cluster.waitForNodeManagersToConnect(10000));
// Simulate heartbeat using NodeStatus fixture
NodeHeartbeatRequest request =
NodeHeartbeatRequest.newInstance(nodeStatus, null, null, null);
ResourceTracker tracker =
ServerRMProxy.createRMProxy(conf, ResourceTracker.class, true);
tracker.nodeHeartbeat(request);
// Give the heartbeat time to propagate to the RM
verifySimulatedUtilization();
// Alter utilization
int responseId = 10;
nodeStatus = createNodeStatus(nm.getNMContext().getNodeId(), responseId,
CONTAINER_PMEM_2, CONTAINER_VMEM_2, CONTAINER_CPU_2,
NODE_PMEM_2, NODE_VMEM_2, NODE_CPU_2);
nm.setNodeStatus(nodeStatus);
tracker.nodeHeartbeat(request);
// Give the heartbeat time to propagate to the RM
verifySimulatedUtilization();
}