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

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

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

ApplicationClientProtocol.getClusterNodeAttributes介绍

[英]The interface used by client to get node attributes available in ResourceManager.
[中]客户端用于获取ResourceManager中可用的节点属性的接口。

代码示例

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

@Override
public GetClusterNodeAttributesResponse getClusterNodeAttributes(
  GetClusterNodeAttributesRequest request)
  throws YarnException, IOException {
 return clientRMProxy.getClusterNodeAttributes(request);
}

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

@Override
public Set<NodeAttributeInfo> getClusterAttributes()
  throws YarnException, IOException {
 GetClusterNodeAttributesRequest request =
   GetClusterNodeAttributesRequest.newInstance();
 return rmClient.getClusterNodeAttributes(request).getNodeAttributes();
}

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

private int printClusterAttributes() throws IOException, YarnException {
 ApplicationClientProtocol protocol = createApplicationProtocol();
 GetClusterNodeAttributesRequest request =
   GetClusterNodeAttributesRequest.newInstance();
 GetClusterNodeAttributesResponse response =
   protocol.getClusterNodeAttributes(request);
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 PrintWriter writer = new PrintWriter(
   new OutputStreamWriter(baos, Charset.forName("UTF-8")));
 writer.format(NODEATTRIBUTEINFO, "Attribute", "Type");
 for (NodeAttributeInfo attr : response.getNodeAttributes()) {
  writer.format(NODEATTRIBUTEINFO, getKeyString(attr.getAttributeKey()),
    attr.getAttributeType().name());
 }
 writer.close();
 sysOut.println(baos.toString("UTF-8"));
 return 0;
}

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

@Override
public GetClusterNodeAttributesResponseProto getClusterNodeAttributes(
  RpcController controller,
  YarnServiceProtos.GetClusterNodeAttributesRequestProto proto)
  throws ServiceException {
 GetClusterNodeAttributesRequest req =
   new GetClusterNodeAttributesRequestPBImpl(proto);
 try {
  GetClusterNodeAttributesResponse resp =
    real.getClusterNodeAttributes(req);
  return ((GetClusterNodeAttributesResponsePBImpl) resp).getProto();
 } catch (YarnException ye) {
  throw new ServiceException(ye);
 } catch (IOException ie) {
  throw new ServiceException(ie);
 }
}

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

GetClusterNodeAttributesRequest.newInstance();
GetClusterNodeAttributesResponse response =
  client.getClusterNodeAttributes(request);
Set<NodeAttributeInfo> attributes = response.getNodeAttributes();
Assert.assertEquals("Size not correct", 3, attributes.size());

相关文章

微信公众号

最新文章

更多

ApplicationClientProtocol类方法