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


Java NodeHeartbeatRequest类代码示例

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


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

示例1: testNodeHeartbeat

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
/**
 * Test the method nodeHeartbeat. Method should return a not null result.
 * 
 */

@Test
public void testNodeHeartbeat() throws Exception {
  NodeHeartbeatRequest request = recordFactory
      .newRecordInstance(NodeHeartbeatRequest.class);
  assertNotNull(client.nodeHeartbeat(request));
  
  ResourceTrackerTestImpl.exception = true;
  try {
    client.nodeHeartbeat(request);
    fail("there  should be YarnException");
  } catch (YarnException e) {
    assertTrue(e.getMessage().startsWith("testMessage"));
  }finally{
    ResourceTrackerTestImpl.exception = false;
  }

}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestResourceTrackerPBClientImpl.java

示例2: populateKeys

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
private void populateKeys(NodeHeartbeatRequest request,
    NodeHeartbeatResponse nodeHeartBeatResponse) {

  // Check if node's masterKey needs to be updated and if the currentKey has
  // roller over, send it across

  // ContainerTokenMasterKey

  MasterKey nextMasterKeyForNode =
      this.containerTokenSecretManager.getNextKey();
  if (nextMasterKeyForNode != null
      && (request.getLastKnownContainerTokenMasterKey().getKeyId()
          != nextMasterKeyForNode.getKeyId())) {
    nodeHeartBeatResponse.setContainerTokenMasterKey(nextMasterKeyForNode);
  }

  // NMTokenMasterKey

  nextMasterKeyForNode = this.nmTokenSecretManager.getNextKey();
  if (nextMasterKeyForNode != null
      && (request.getLastKnownNMTokenMasterKey().getKeyId() 
          != nextMasterKeyForNode.getKeyId())) {
    nodeHeartBeatResponse.setNMTokenMasterKey(nextMasterKeyForNode);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:ResourceTrackerService.java

示例3: run

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
public void run() {
  int lastResponseID = 0;
  while (!stopT) {
    try {
      org.apache.hadoop.yarn.server.api.records.NodeStatus nodeStatus =
          recordFactory
              .newRecordInstance(org.apache.hadoop.yarn.server.api.records.NodeStatus.class);
      nodeStatus.setNodeId(request3.getNodeId());
      nodeStatus.setResponseId(lastResponseID);
      nodeStatus.setNodeHealthStatus(recordFactory.newRecordInstance(NodeHealthStatus.class));
      nodeStatus.getNodeHealthStatus().setIsNodeHealthy(true);

      NodeHeartbeatRequest request = recordFactory
          .newRecordInstance(NodeHeartbeatRequest.class);
      request.setNodeStatus(nodeStatus);
      lastResponseID = resourceTrackerService.nodeHeartbeat(request)
          .getResponseId();

      Thread.sleep(1000);
    } catch(Exception e) {
      LOG.info("failed to heartbeat ", e);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestNMExpiry.java

示例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, 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

示例5: nodeHeartbeat

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  System.out.println("RTS receive heartbeat : "
      + System.currentTimeMillis());
  labels = request.getNodeLabels();
  NodeStatus nodeStatus = request.getNodeStatus();
  nodeStatus.setResponseId(heartbeatID++);

  NodeHeartbeatResponse nhResponse =
      YarnServerBuilderUtils.newNodeHeartbeatResponse(heartbeatID,
          NodeAction.NORMAL, null, null, null, null, 1000L);

  // to ensure that heartbeats are sent only when required.
  nhResponse.setNextHeartBeatInterval(Long.MAX_VALUE);
  nhResponse.setAreNodeLabelsAcceptedByRM(labels != null);

  synchronized (ResourceTrackerForLabels.class) {
    receivedNMHeartbeat = true;
    ResourceTrackerForLabels.class.notifyAll();
  }
  return nhResponse;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestNodeStatusUpdaterForLabels.java

示例6: 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);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例7: 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);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例8: 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);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例9: nodeHeartbeat

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeHeartbeatRequestProto requestProto = ((NodeHeartbeatRequestPBImpl)request).getProto();
  try {
    return new NodeHeartbeatResponsePBImpl(proxy.nodeHeartbeat(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:ResourceTrackerPBClientImpl.java

示例10: testPbRecordFactory

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
@Test
public void testPbRecordFactory() {
  RecordFactory pbRecordFactory = RecordFactoryPBImpl.get();
  try {
    NodeHeartbeatRequest request = pbRecordFactory.newRecordInstance(NodeHeartbeatRequest.class);
    Assert.assertEquals(NodeHeartbeatRequestPBImpl.class, request.getClass());
  } catch (YarnRuntimeException e) {
    e.printStackTrace();
    Assert.fail("Failed to crete record");
  }
  
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:TestYSCRecordFactory.java

示例11: nodeHeartbeat

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  if (exception) {
    throw new YarnException("testMessage");
  }
  return recordFactory.newRecordInstance(NodeHeartbeatResponse.class);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestResourceTrackerPBClientImpl.java

示例12: nodeHeartbeat

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeStatus nodeStatus = request.getNodeStatus();
  nodeStatus.setResponseId(heartBeatID++);

  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils.
      newNodeHeartbeatResponse(heartBeatID, heartBeatNodeAction, null,
          null, null, null, 1000L);
  nhResponse.setDiagnosticsMessage(shutDownMessage);
  return nhResponse;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:TestNodeStatusUpdater.java

示例13: nodeHeartbeat

import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest; //导入依赖的package包/类
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeStatus nodeStatus = request.getNodeStatus();
  LOG.info("Got heartbeat number " + heartBeatID);
  nodeStatus.setResponseId(heartBeatID++);

  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils
      .newNodeHeartbeatResponse(heartBeatID, null, null,
          null, null, null, 1000L);
  return nhResponse;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:MockNodeStatusUpdater.java


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