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

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

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

YarnClusterMetrics.setNumDecommissionedNodeManagers介绍

暂无

代码示例

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

@Override
public GetClusterMetricsResponse getClusterMetrics(
  GetClusterMetricsRequest request) throws YarnException {
 GetClusterMetricsResponse response = recordFactory
   .newRecordInstance(GetClusterMetricsResponse.class);
 YarnClusterMetrics ymetrics = recordFactory
   .newRecordInstance(YarnClusterMetrics.class);
 ymetrics.setNumNodeManagers(this.rmContext.getRMNodes().size());
 ClusterMetrics clusterMetrics = ClusterMetrics.getMetrics();
 ymetrics.setNumDecommissionedNodeManagers(clusterMetrics
  .getNumDecommisionedNMs());
 ymetrics.setNumActiveNodeManagers(clusterMetrics.getNumActiveNMs());
 ymetrics.setNumLostNodeManagers(clusterMetrics.getNumLostNMs());
 ymetrics.setNumUnhealthyNodeManagers(clusterMetrics.getUnhealthyNMs());
 ymetrics.setNumRebootedNodeManagers(clusterMetrics.getNumRebootedNMs());
 response.setClusterMetrics(ymetrics);
 return response;
}

代码示例来源: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);
 }
}

相关文章