gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 03:56:40 28 4
gpt4 key购买 nike

本文整理了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<NodeReport> 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<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: 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<NodeReport> 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 < timeout / 10; 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 < timeout / 10; 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<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);
 }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com