本文整理了Java中org.apache.hadoop.yarn.api.records.YarnClusterMetrics
类的一些代码示例,展示了YarnClusterMetrics
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnClusterMetrics
类的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.YarnClusterMetrics
类名称:YarnClusterMetrics
[英]YarnClusterMetrics
represents cluster metrics.
Currently only number of NodeManager
s is provided.
[中]YarnClusterMetrics
表示集群指标。
目前只提供了NodeManager
个。
代码示例来源:origin: apache/flink
ps.append("NodeManagers in the ClusterClient " + metrics.getNumNodeManagers());
List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING);
final String format = "|%-16s |%-16s %n";
代码示例来源: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);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-client
protected NodesInformation getNodesInfo() {
NodesInformation nodeInfo = new NodesInformation();
YarnClusterMetrics yarnClusterMetrics;
try {
yarnClusterMetrics = client.getYarnClusterMetrics();
} catch (IOException ie) {
LOG.error("Unable to fetch cluster metrics", ie);
return nodeInfo;
} catch (YarnException ye) {
LOG.error("Unable to fetch cluster metrics", ye);
return nodeInfo;
}
nodeInfo.decommissionedNodes =
yarnClusterMetrics.getNumDecommissionedNodeManagers();
nodeInfo.totalNodes = yarnClusterMetrics.getNumNodeManagers();
nodeInfo.runningNodes = yarnClusterMetrics.getNumActiveNodeManagers();
nodeInfo.lostNodes = yarnClusterMetrics.getNumLostNodeManagers();
nodeInfo.unhealthyNodes = yarnClusterMetrics.getNumUnhealthyNodeManagers();
nodeInfo.rebootedNodes = yarnClusterMetrics.getNumRebootedNodeManagers();
return nodeInfo;
}
代码示例来源: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: io.hops/hadoop-yarn-api
@Private
@Unstable
public static YarnClusterMetrics newInstance(int numNodeManagers) {
YarnClusterMetrics metrics = Records.newRecord(YarnClusterMetrics.class);
metrics.setNumNodeManagers(numNodeManagers);
return metrics;
}
代码示例来源:origin: io.hops/hadoop-yarn-client
protected NodesInformation getNodesInfo() {
NodesInformation nodeInfo = new NodesInformation();
YarnClusterMetrics yarnClusterMetrics;
try {
yarnClusterMetrics = client.getYarnClusterMetrics();
} catch (IOException ie) {
LOG.error("Unable to fetch cluster metrics", ie);
return nodeInfo;
} catch (YarnException ye) {
LOG.error("Unable to fetch cluster metrics", ye);
return nodeInfo;
}
nodeInfo.decommissionedNodes =
yarnClusterMetrics.getNumDecommissionedNodeManagers();
nodeInfo.totalNodes = yarnClusterMetrics.getNumNodeManagers();
nodeInfo.runningNodes = yarnClusterMetrics.getNumActiveNodeManagers();
nodeInfo.lostNodes = yarnClusterMetrics.getNumLostNodeManagers();
nodeInfo.unhealthyNodes = yarnClusterMetrics.getNumUnhealthyNodeManagers();
nodeInfo.rebootedNodes = yarnClusterMetrics.getNumRebootedNodeManagers();
return nodeInfo;
}
代码示例来源:origin: ch.cern.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());
response.setClusterMetrics(ymetrics);
return response;
}
代码示例来源:origin: alibaba/jstorm
+ ", numNodeManagers=" + clusterMetrics.getNumNodeManagers());
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-api
@Private
@Unstable
public static YarnClusterMetrics newInstance(int numNodeManagers) {
YarnClusterMetrics metrics = Records.newRecord(YarnClusterMetrics.class);
metrics.setNumNodeManagers(numNodeManagers);
return metrics;
}
代码示例来源:origin: Qihoo360/XLearning
yarnClient.init(conf);
yarnClient.start();
LOG.info("Requesting a new application from cluster with " + yarnClient.getYarnClusterMetrics().getNumNodeManagers() + " NodeManagers");
newAPP = yarnClient.createApplication();
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-api
@Private
@Unstable
public static YarnClusterMetrics newInstance(int numNodeManagers) {
YarnClusterMetrics metrics = Records.newRecord(YarnClusterMetrics.class);
metrics.setNumNodeManagers(numNodeManagers);
return metrics;
}
代码示例来源:origin: apache/metron
+ ", numNodeManagers=" + clusterMetrics.getNumNodeManagers());
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-api
@Private
@Unstable
public static YarnClusterMetrics newInstance(int numNodeManagers) {
YarnClusterMetrics metrics = Records.newRecord(YarnClusterMetrics.class);
metrics.setNumNodeManagers(numNodeManagers);
return metrics;
}
代码示例来源:origin: org.apache.tez/tez-mapreduce
public ClusterMetrics getClusterMetrics() throws IOException,
InterruptedException {
YarnClusterMetrics metrics;
try {
metrics = client.getYarnClusterMetrics();
} catch (YarnException e) {
throw new IOException(e);
}
ClusterMetrics oldMetrics = new ClusterMetrics(1, 1, 1, 1, 1, 1,
metrics.getNumNodeManagers() * 10, metrics.getNumNodeManagers() * 2, 1,
metrics.getNumNodeManagers(), 0, 0);
return oldMetrics;
}
代码示例来源:origin: com.github.jiayuhan-it/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());
response.setClusterMetrics(ymetrics);
return response;
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-jobclient
public ClusterMetrics getClusterMetrics() throws IOException,
InterruptedException {
try {
YarnClusterMetrics metrics = client.getYarnClusterMetrics();
ClusterMetrics oldMetrics =
new ClusterMetrics(1, 1, 1, 1, 1, 1,
metrics.getNumNodeManagers() * 10,
metrics.getNumNodeManagers() * 2, 1,
metrics.getNumNodeManagers(), 0, 0);
return oldMetrics;
} catch (YarnException e) {
throw new IOException(e);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-jobclient
public ClusterMetrics getClusterMetrics() throws IOException,
InterruptedException {
try {
YarnClusterMetrics metrics = client.getYarnClusterMetrics();
ClusterMetrics oldMetrics =
new ClusterMetrics(1, 1, 1, 1, 1, 1,
metrics.getNumNodeManagers() * 10,
metrics.getNumNodeManagers() * 2, 1,
metrics.getNumNodeManagers(), 0, 0);
return oldMetrics;
} catch (YarnException e) {
throw new IOException(e);
}
}
代码示例来源:origin: org.apache.flink/flink-yarn_2.11
ps.append("NodeManagers in the ClusterClient " + metrics.getNumNodeManagers());
List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING);
final String format = "|%-16s |%-16s %n";
代码示例来源:origin: org.apache.flink/flink-yarn
ps.append("NodeManagers in the ClusterClient " + metrics.getNumNodeManagers());
List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING);
final String format = "|%-16s |%-16s %n";
代码示例来源:origin: hopshadoop/hopsworks
getNumNodeManagers());
List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING);
final String format = "|%-16s |%-16s %n";
内容来源于网络,如有侵权,请联系作者删除!