热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

本文整理了Java中org.apache.hadoop.yarn.api.records.YarnClusterMetrics.getNumNodeManagers()

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

YarnClusterMetrics.getNumNodeManagers介绍

[英]Get the number of NodeManagers in the cluster.
[中]获取群集中的NodeManager个数。

代码示例

代码示例来源:origin: apache/flink

ps.append("NodeManagers in the ClusterClient " + metrics.getNumNodeManagers());
List nodes = yarnClient.getNodeReports(NodeState.RUNNING);
final String format = "|%-16s |%-16s %n";

代码示例来源:origin: alibaba/jstorm

+ ", numNodeManagers=" + clusterMetrics.getNumNodeManagers());

代码示例来源: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: apache/metron

+ ", numNodeManagers=" + clusterMetrics.getNumNodeManagers());

代码示例来源: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.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: 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 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 nodes = yarnClient.getNodeReports(NodeState.RUNNING);
final String format = "|%-16s |%-16s %n";

代码示例来源: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: hopshadoop/hopsworks

getNumNodeManagers());
List nodes = yarnClient.getNodeReports(NodeState.RUNNING);
final String format = "|%-16s |%-16s %n";

代码示例来源: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: org.apache.hadoop/hadoop-yarn-applications-distributedshell

+ ", numNodeManagers=" + clusterMetrics.getNumNodeManagers());

代码示例来源:origin: apache/hama

YarnClusterMetrics clusterMetrics = yarnClient.getYarnClusterMetrics();
LOG.info("Got Cluster metric info from ASM"
+ ", numNodeManagers=" + clusterMetrics.getNumNodeManagers());

代码示例来源:origin: org.apache.apex/apex-engine

LOG.info("Got Cluster metric info from ASM, numNodeManagers={}", clusterMetrics.getNumNodeManagers());

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

/**
* Wait for all the NodeManagers to connect to the ResourceManager.
*
* @param timeout Time to wait (sleeps in 10 ms intervals) in milliseconds.
* @return true if all NodeManagers connect to the (Active)
* ResourceManager, false otherwise.
* @throws YarnException if there is no active RM
* @throws InterruptedException if any thread has interrupted
* the current thread
*/
public boolean waitForNodeManagersToConnect(long timeout)
throws YarnException, InterruptedException {
GetClusterMetricsRequest req = GetClusterMetricsRequest.newInstance();
for (int i = 0; i ResourceManager rm = getResourceManager();
if (rm == null) {
throw new YarnException("Can not find the active RM.");
}
else if (nodeManagers.length == rm.getClientRMService()
.getClusterMetrics(req).getClusterMetrics().getNumNodeManagers()) {
LOG.info("All Node Managers connected in MiniYARNCluster");
return true;
}
Thread.sleep(10);
}
LOG.info("Node Managers did not connect within 5000ms");
return false;
}

代码示例来源:origin: linkedin/dynamometer

LOG.info("Got Cluster metric info from ASM, numNodeManagers=" + clusterMetrics.getNumNodeManagers());

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

/**
* Wait for all the NodeManagers to connect to the ResourceManager.
*
* @param timeout Time to wait (sleeps in 10 ms intervals) in milliseconds.
* @return true if all NodeManagers connect to the (Active)
* ResourceManager, false otherwise.
* @throws YarnException
* @throws InterruptedException
*/
public boolean waitForNodeManagersToConnect(long timeout)
throws YarnException, InterruptedException {
GetClusterMetricsRequest req = GetClusterMetricsRequest.newInstance();
for (int i = 0; i ResourceManager rm = getResourceManager();
if (rm == null) {
throw new YarnException("Can not find the active RM.");
}
else if (nodeManagers.length == rm.getClientRMService()
.getClusterMetrics(req).getClusterMetrics().getNumNodeManagers()) {
LOG.info("All Node Managers connected in MiniYARNCluster");
return true;
}
Thread.sleep(10);
}
return false;
}

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

public static GetClusterMetricsResponse merge(
Collection 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);
}
}

推荐阅读
author-avatar
樱花落下的那天
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有