org.apache.hadoop.yarn.api.records.YarnClusterMetrics.newInstance()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(88)

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

YarnClusterMetrics.newInstance介绍

暂无

代码示例

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

@Override
public GetClusterMetricsResponse getClusterMetrics(
  GetClusterMetricsRequest request) throws YarnException, IOException {
 validateRunning();
 YarnClusterMetrics clusterMetrics = YarnClusterMetrics.newInstance(1);
 return GetClusterMetricsResponse.newInstance(clusterMetrics);
}

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

public static GetClusterMetricsResponse merge(
   Collection<GetClusterMetricsResponse> responses) {
  YarnClusterMetrics tmp = YarnClusterMetrics.newInstance(0);
  for (GetClusterMetricsResponse response : responses) {
   YarnClusterMetrics metrics = response.getClusterMetrics();
   tmp.setNumNodeManagers(
     tmp.getNumNodeManagers() + metrics.getNumNodeManagers());
   tmp.setNumActiveNodeManagers(
     tmp.getNumActiveNodeManagers() + metrics.getNumActiveNodeManagers());
   tmp.setNumDecommissionedNodeManagers(
     tmp.getNumDecommissionedNodeManagers() + metrics
       .getNumDecommissionedNodeManagers());
   tmp.setNumLostNodeManagers(
     tmp.getNumLostNodeManagers() + metrics.getNumLostNodeManagers());
   tmp.setNumRebootedNodeManagers(tmp.getNumRebootedNodeManagers() + metrics
     .getNumRebootedNodeManagers());
   tmp.setNumUnhealthyNodeManagers(
     tmp.getNumUnhealthyNodeManagers() + metrics
       .getNumUnhealthyNodeManagers());
  }
  return GetClusterMetricsResponse.newInstance(tmp);
 }
}

相关文章