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

Java GetClusterNodesResponse类代码示例

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

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



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

示例1: getClusterNodes

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
    throws YarnException {
  GetClusterNodesResponse response = 
    recordFactory.newRecordInstance(GetClusterNodesResponse.class);
  EnumSet<NodeState> nodeStates = request.getNodeStates();
  if (nodeStates == null || nodeStates.isEmpty()) {
    nodeStates = EnumSet.allOf(NodeState.class);
  }
  Collection<RMNode> nodes = RMServerUtils.queryRMNodes(rmContext,
      nodeStates);
  
  List<NodeReport> nodeReports = new ArrayList<NodeReport>(nodes.size());
  for (RMNode nodeInfo : nodes) {
    nodeReports.add(createNodeReports(nodeInfo));
  }
  response.setNodeReports(nodeReports);
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:ClientRMService.java


示例2: run

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public void run() {
    EnumSet<NodeState> filter = EnumSet.of(NodeState.RUNNING);
    GetClusterNodesRequest req = GetClusterNodesRequest.newInstance();
    req.setNodeStates(filter);
    LOG.debug("Sending cluster nodes request from first client");
    try {
        TimeUnit.SECONDS.sleep(1);
        GetClusterNodesResponse res = client.getClusterNodes(req);
        assertNotNull("Response from the first client should not be null", res);
        LOG.debug("NodeReports: " + res.getNodeReports().size());
        for (NodeReport nodeReport : res.getNodeReports()) {
            LOG.debug("Node: " + nodeReport.getNodeId() + " Capability: " + nodeReport.getCapability());
        }
    } catch (Exception ex) {
        LOG.error(ex, ex);
    }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:19,代码来源:TestYarnSSLServer.java


示例3: getClusterNodes

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
    throws YarnException {
  GetClusterNodesResponse response =
    recordFactory.newRecordInstance(GetClusterNodesResponse.class);
  EnumSet<NodeState> nodeStates = request.getNodeStates();
  if (nodeStates == null || nodeStates.isEmpty()) {
    nodeStates = EnumSet.allOf(NodeState.class);
  }
  Collection<RMNode> nodes = RMServerUtils.queryRMNodes(rmContext,
      nodeStates);
  
  List<NodeReport> nodeReports = new ArrayList<NodeReport>(nodes.size());
  for (RMNode nodeInfo : nodes) {
    nodeReports.add(createNodeReports(nodeInfo));
  }
  response.setNodeReports(nodeReports);
  return response;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:20,代码来源:ClientRMService.java


示例4: getClusterNodes

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
    throws YarnException {
  GetClusterNodesResponse response = 
    recordFactory.newRecordInstance(GetClusterNodesResponse.class);
  EnumSet<NodeState> nodeStates = request.getNodeStates();
  if (nodeStates == null || nodeStates.isEmpty()) {
    nodeStates = EnumSet.allOf(NodeState.class);
  }
  Collection<RMNode> nodes = RMServerUtils.queryRMNodes(rmContext,
      nodeStates);
  List<NodeReport> nodeReports = new ArrayList<NodeReport>(nodes.size());
  for (RMNode nodeInfo : nodes) {
    nodeReports.add(createNodeReports(nodeInfo));
  }
  response.setNodeReports(nodeReports);
  return response;
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:19,代码来源:ClientRMService.java


示例5: getClusterNodes

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public GetClusterNodesResponse
    getClusterNodes(GetClusterNodesRequest request)
        throws YarnException, IOException {
  GetClusterNodesRequestProto requestProto =
      ((GetClusterNodesRequestPBImpl) request).getProto();
  try {
    return new GetClusterNodesResponsePBImpl(proxy.getClusterNodes(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ApplicationClientProtocolPBClientImpl.java


示例6: getNodeReports

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public List<NodeReport> getNodeReports(NodeState... states) throws YarnException,
    IOException {
  EnumSet<NodeState> statesSet = (states.length == 0) ?
      EnumSet.allOf(NodeState.class) : EnumSet.noneOf(NodeState.class);
  for (NodeState state : states) {
    statesSet.add(state);
  }
  GetClusterNodesRequest request = GetClusterNodesRequest
      .newInstance(statesSet);
  GetClusterNodesResponse response = rmClient.getClusterNodes(request);
  return response.getNodeReports();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:YarnClientImpl.java


示例7: getClusterNodes

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public GetClusterNodesResponse getClusterNodes(
    GetClusterNodesRequest request)
    throws YarnException {
  resetStartFailoverFlag(true);

  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());

  // create GetClusterNodesResponse with fake ClusterNodeLists
  GetClusterNodesResponse response =
      GetClusterNodesResponse.newInstance(createFakeNodeReports());
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ProtocolHATestBase.java


示例8: getClusterNodes

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
    throws YarnException, IOException {
  List<NodeReport> clusterNodes = appClient.getClusterNodes(request
      .getNodeStates());
  return GetClusterNodesResponse.newInstance(clusterNodes);
}
 
开发者ID:intel-hpdd,项目名称:scheduling-connector-for-hadoop,代码行数:8,代码来源:HPCApplicationClientProtocolImpl.java


示例9: checkNodeState

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
private void checkNodeState() throws YarnException
{
  GetClusterNodesRequest request = Records.newRecord(GetClusterNodesRequest.class);
  ClientRMService clientRMService = yarnCluster.getResourceManager().getClientRMService();
  GetClusterNodesResponse response = clientRMService.getClusterNodes(request);
  List<NodeReport> nodeReports = response.getNodeReports();
  LOG.info("{}", nodeReports);

  for (NodeReport nr: nodeReports) {
    if (!nr.getNodeState().isUnusable()) {
      return;
    }
  }
  fail("Yarn Mini cluster should have at least one usable node.");
}
 
开发者ID:apache,项目名称:apex-core,代码行数:16,代码来源:StramMiniClusterTest.java


示例10: testRpcCall

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Test(timeout = 3000)
public void testRpcCall() throws Exception {
    EnumSet<NodeState> filter = EnumSet.of(NodeState.RUNNING);
    GetClusterNodesRequest req = GetClusterNodesRequest.newInstance();
    req.setNodeStates(filter);
    LOG.debug("Sending request");
    GetClusterNodesResponse res = acClient.getClusterNodes(req);
    LOG.debug("Got response from server");
    assertNotNull("Response should not be null", res);
    List<NodeReport> reports = res.getNodeReports();
    LOG.debug("Printing cluster nodes report");
    for (NodeReport report : reports) {
        LOG.debug("NodeId: " + report.getNodeId().toString());
    }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:16,代码来源:TestYarnSSLServer.java


示例11: testResourceMgrDelegate

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Test(timeout=20000)
public void testResourceMgrDelegate() throws Exception {
  /* we not want a mock of resource mgr delegate */
  final ApplicationClientProtocol clientRMProtocol = mock(ApplicationClientProtocol.class);
  ResourceMgrDelegate delegate = new ResourceMgrDelegate(conf) {
    @Override
    protected void serviceStart() throws Exception {
      assertTrue(this.client instanceof YarnClientImpl);
      ((YarnClientImpl) this.client).setRMClient(clientRMProtocol);
    }
  };
  /* make sure kill calls finish application master */
  when(clientRMProtocol.forceKillApplication(any(KillApplicationRequest.class)))
  .thenReturn(KillApplicationResponse.newInstance(true));
  delegate.killApplication(appId);
  verify(clientRMProtocol).forceKillApplication(any(KillApplicationRequest.class));

  /* make sure getalljobs calls get all applications */
  when(clientRMProtocol.getApplications(any(GetApplicationsRequest.class))).
  thenReturn(recordFactory.newRecordInstance(GetApplicationsResponse.class));
  delegate.getAllJobs();
  verify(clientRMProtocol).getApplications(any(GetApplicationsRequest.class));

  /* make sure getapplication report is called */
  when(clientRMProtocol.getApplicationReport(any(GetApplicationReportRequest.class)))
  .thenReturn(recordFactory.newRecordInstance(GetApplicationReportResponse.class));
  delegate.getApplicationReport(appId);
  verify(clientRMProtocol).getApplicationReport(any(GetApplicationReportRequest.class));

  /* make sure metrics is called */
  GetClusterMetricsResponse clusterMetricsResponse = recordFactory.newRecordInstance
      (GetClusterMetricsResponse.class);
  clusterMetricsResponse.setClusterMetrics(recordFactory.newRecordInstance(
      YarnClusterMetrics.class));
  when(clientRMProtocol.getClusterMetrics(any(GetClusterMetricsRequest.class)))
  .thenReturn(clusterMetricsResponse);
  delegate.getClusterMetrics();
  verify(clientRMProtocol).getClusterMetrics(any(GetClusterMetricsRequest.class));

  when(clientRMProtocol.getClusterNodes(any(GetClusterNodesRequest.class))).
  thenReturn(recordFactory.newRecordInstance(GetClusterNodesResponse.class));
  delegate.getActiveTrackers();
  verify(clientRMProtocol).getClusterNodes(any(GetClusterNodesRequest.class));
  
  GetNewApplicationResponse newAppResponse = recordFactory.newRecordInstance(
      GetNewApplicationResponse.class);
  newAppResponse.setApplicationId(appId);
  when(clientRMProtocol.getNewApplication(any(GetNewApplicationRequest.class))).
  thenReturn(newAppResponse);
  delegate.getNewJobID();
  verify(clientRMProtocol).getNewApplication(any(GetNewApplicationRequest.class));
  
  GetQueueInfoResponse queueInfoResponse = recordFactory.newRecordInstance(
      GetQueueInfoResponse.class);
  queueInfoResponse.setQueueInfo(recordFactory.newRecordInstance(QueueInfo.class));
  when(clientRMProtocol.getQueueInfo(any(GetQueueInfoRequest.class))).
  thenReturn(queueInfoResponse);
  delegate.getQueues();
  verify(clientRMProtocol).getQueueInfo(any(GetQueueInfoRequest.class));

  GetQueueUserAclsInfoResponse aclResponse = recordFactory.newRecordInstance(
      GetQueueUserAclsInfoResponse.class);
  when(clientRMProtocol.getQueueUserAcls(any(GetQueueUserAclsInfoRequest.class)))
  .thenReturn(aclResponse);
  delegate.getQueueAclsForCurrentUser();
  verify(clientRMProtocol).getQueueUserAcls(any(GetQueueUserAclsInfoRequest.class));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:68,代码来源:TestYARNRunner.java


示例12: getClusterNodes

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public GetClusterNodesResponse getClusterNodes(
    GetClusterNodesRequest request) throws IOException {
  return null;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:TestClientRedirect.java


示例13: getClusterNodes

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; //导入依赖的package包/类
@Override
public GetClusterNodesResponse getClusterNodes(
    GetClusterNodesRequest request) throws YarnException, IOException {
  throw new NotImplementedException();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:6,代码来源:MockResourceManagerFacade.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IEnergySource类代码示例发布时间:2022-05-21
下一篇:
Java Configuration类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap