org.apache.hadoop.yarn.api.ApplicationClientProtocol.getClusterNodes()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中org.apache.hadoop.yarn.api.ApplicationClientProtocol.getClusterNodes()方法的一些代码示例,展示了ApplicationClientProtocol.getClusterNodes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationClientProtocol.getClusterNodes()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.api.ApplicationClientProtocol
类名称:ApplicationClientProtocol
方法名:getClusterNodes

ApplicationClientProtocol.getClusterNodes介绍

[英]The interface used by clients to get a report of all nodes in the cluster from the ResourceManager.

The ResourceManager responds with a GetClusterNodesResponse which includes the NodeReport for all the nodes in the cluster.
[中]客户端用于从ResourceManager获取集群中所有节点的报告的接口。
ResourceManager以getClusterNodeResponse响应,其中包括集群中所有节点的NodeReport。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-router

@Override
public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
  throws YarnException, IOException {
 return clientRMProxy.getClusterNodes(request);
}

代码示例来源:origin: io.hops/hadoop-yarn-client

@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();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-client

@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();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-client

@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();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-client

@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();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

@Override
public GetClusterNodesResponseProto getClusterNodes(RpcController controller,
  GetClusterNodesRequestProto proto) throws ServiceException {
 GetClusterNodesRequestPBImpl request =
  new GetClusterNodesRequestPBImpl(proto);
 try {
  GetClusterNodesResponse response = real.getClusterNodes(request);
  return ((GetClusterNodesResponsePBImpl)response).getProto();
 } catch (YarnException e) {
  throw new ServiceException(e);
 } catch (IOException e) {
  throw new ServiceException(e);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

@Override
public GetClusterNodesResponseProto getClusterNodes(RpcController controller,
  GetClusterNodesRequestProto proto) throws ServiceException {
 GetClusterNodesRequestPBImpl request =
  new GetClusterNodesRequestPBImpl(proto);
 try {
  GetClusterNodesResponse response = real.getClusterNodes(request);
  return ((GetClusterNodesResponsePBImpl)response).getProto();
 } catch (YarnException e) {
  throw new ServiceException(e);
 } catch (IOException e) {
  throw new ServiceException(e);
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-common

@Override
public GetClusterNodesResponseProto getClusterNodes(RpcController controller,
  GetClusterNodesRequestProto proto) throws ServiceException {
 GetClusterNodesRequestPBImpl request =
  new GetClusterNodesRequestPBImpl(proto);
 try {
  GetClusterNodesResponse response = real.getClusterNodes(request);
  return ((GetClusterNodesResponsePBImpl)response).getProto();
 } catch (YarnException e) {
  throw new ServiceException(e);
 } catch (IOException e) {
  throw new ServiceException(e);
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient

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));

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test
public void testRMStartWithDecommissionedNode() throws Exception {
 String excludeFile = "excludeFile";
 createExcludeFile(excludeFile);
 YarnConfiguration conf = new YarnConfiguration();
 conf.set(YarnConfiguration.RM_NODES_EXCLUDE_FILE_PATH,
   excludeFile);
 MockRM rm = new MockRM(conf) {
  protected ClientRMService createClientRMService() {
   return new ClientRMService(this.rmContext, scheduler,
     this.rmAppManager, this.applicationACLsManager, this.queueACLsManager,
     this.getRMContext().getRMDelegationTokenSecretManager());
  };
 };
 rm.start();
 YarnRPC rpc = YarnRPC.create(conf);
 InetSocketAddress rmAddress = rm.getClientRMService().getBindAddress();
 LOG.info("Connecting to ResourceManager at " + rmAddress);
 ApplicationClientProtocol client =
   (ApplicationClientProtocol) rpc
     .getProxy(ApplicationClientProtocol.class, rmAddress, conf);
 // Make call
 GetClusterNodesRequest request =
   GetClusterNodesRequest.newInstance(EnumSet.allOf(NodeState.class));
 List<NodeReport> nodeReports = client.getClusterNodes(request).getNodeReports();
 Assert.assertEquals(1, nodeReports.size());
 rm.stop();
 rpc.stopProxy(client, conf);
 new File(excludeFile).delete();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

List<NodeReport> nodeReports = client.getClusterNodes(request).getNodeReports();
Assert.assertEquals(1, nodeReports.size());

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

GetClusterNodesRequest.newInstance(EnumSet.of(NodeState.RUNNING));
List<NodeReport> nodeReports =
  client.getClusterNodes(request).getNodeReports();
Assert.assertEquals(1, nodeReports.size());
Assert.assertNotSame("Node is expected to be healthy!", NodeState.UNHEALTHY,
nodeReports = client.getClusterNodes(request).getNodeReports();
Assert.assertEquals("Unhealthy nodes should not show up by default", 0,
  nodeReports.size());
nodeReports = client.getClusterNodes(request).getNodeReports();
Assert.assertEquals(1, nodeReports.size());
Assert.assertEquals("Node is expected to be unhealthy!", NodeState.UNHEALTHY,
nodeReports = client.getClusterNodes(request).getNodeReports();
Assert.assertEquals(3, nodeReports.size());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

GetClusterNodesRequest.newInstance(EnumSet.of(NodeState.RUNNING));
List<NodeReport> nodeReports =
  client.getClusterNodes(request).getNodeReports();
Assert.assertEquals(1, nodeReports.size());
Assert.assertNotSame("Node is expected to be healthy!", NodeState.UNHEALTHY,
nodeReports = client.getClusterNodes(request).getNodeReports();
Assert.assertEquals("Unhealthy nodes should not show up by default", 0,
  nodeReports.size());
nodeReports = client.getClusterNodes(request).getNodeReports();
Assert.assertEquals(1, nodeReports.size());
Assert.assertEquals("Node is expected to be unhealthy!", NodeState.UNHEALTHY,
nodeReports = client.getClusterNodes(request).getNodeReports();
Assert.assertEquals(3, nodeReports.size());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

List<NodeReport> nodeReports = client.getClusterNodes(
  GetClusterNodesRequest.newInstance(
    EnumSet.of(NodeState.DECOMMISSIONING)))

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

GetClusterNodesRequest.newInstance(EnumSet.of(NodeState.RUNNING));
List<NodeReport> nodeReports =
  client.getClusterNodes(request).getNodeReports();
Assert.assertEquals(1, nodeReports.size());
Assert.assertNotSame("Node is expected to be healthy!", NodeState.UNHEALTHY,

相关文章

微信公众号

最新文章

更多

ApplicationClientProtocol类方法