@Override public List<NodeReport> getNodeReports() throws YarnFacadeException { try { return client.getNodeReports(NodeState.RUNNING); } catch (Exception e) { throw new YarnFacadeException("getNodeReports failed", e); } }
private ClusterResourceDescription getCurrentFreeClusterResources(YarnClient yarnClient) throws YarnException, IOException { List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING); int totalFreeMemory = 0; int containerLimit = 0; int[] nodeManagersFree = new int[nodes.size()]; for (int i = 0; i < nodes.size(); i++) { NodeReport rep = nodes.get(i); int free = rep.getCapability().getMemory() - (rep.getUsed() != null ? rep.getUsed().getMemory() : 0); nodeManagersFree[i] = free; totalFreeMemory += free; if (free > containerLimit) { containerLimit = free; } } return new ClusterResourceDescription(totalFreeMemory, containerLimit, nodeManagersFree); }
List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING); final String format = "|%-16s |%-16s %n"; ps.printf("|Property |Value %n");
numYarnMaxVcores = yarnClient.getNodeReports(NodeState.RUNNING) .stream() .mapToInt(report -> report.getCapability().getVirtualCores())
+ ", numNodeManagers=" + clusterMetrics.getNumNodeManagers()); List<NodeReport> clusterNodeReports = jstormClientContext.yarnClient.getNodeReports( NodeState.RUNNING); LOG.info("Got Cluster node info from ASM, count is " + String.valueOf(clusterNodeReports.size()));
+ ", numNodeManagers=" + clusterMetrics.getNumNodeManagers()); List<NodeReport> clusterNodeReports = yarnClient.getNodeReports( NodeState.RUNNING); LOG.info("Got Cluster node info from ASM");
@Override public List<NodeReport> getNodeReports(NodeState... states) throws YarnException, IOException { return client.getNodeReports(states); }
@Override public List<NodeReport> getNodeReports(NodeState... states) throws YarnException, IOException { return client.getNodeReports(states); }
public TaskTrackerInfo[] getActiveTrackers() throws IOException, InterruptedException { try { return TypeConverter.fromYarnNodes(client.getNodeReports()); } catch (YarnException e) { throw new IOException(e); } }
public TaskTrackerInfo[] getActiveTrackers() throws IOException, InterruptedException { try { return TypeConverter.fromYarnNodes( client.getNodeReports(NodeState.RUNNING)); } catch (YarnException e) { throw new IOException(e); } }
@Override public List<NodeReport> call() throws Exception { yarnClient.start(); return yarnClient.getNodeReports(); } });
public TaskTrackerInfo[] getActiveTrackers() throws IOException, InterruptedException { try { return TypeConverter.fromYarnNodes( client.getNodeReports(NodeState.RUNNING)); } catch (YarnException e) { throw new IOException(e); } }
@Override public List<NodeReport> getNodeReports() throws Exception { YarnClient yarnClient = createYarnClient(); try { return yarnClient.getNodeReports(); } finally { yarnClient.stop(); } }
@Override public List<NodeReport> getNodeReports() throws Exception { YarnClient yarnClient = createYarnClient(); try { return yarnClient.getNodeReports(); } finally { yarnClient.stop(); } }
YarnClient client = YarnClient.createYarnClient(); Configuration config = context.getConfiguration(); client.init(new YarnConfiguration(config)); client.start(); try { List<NodeReport> reports = client.getNodeReports(NodeState.RUNNING); System.out.println(reports.size()); } catch (Exception ex) { System.err.println(ex.getMessage()); } client.stop();
/** * Lists the nodes matching the given node states * * @param nodeStates * @throws YarnException * @throws IOException */ private void listClusterNodes(Set<NodeState> nodeStates) throws YarnException, IOException { PrintWriter writer = new PrintWriter( new OutputStreamWriter(sysout, Charset.forName("UTF-8"))); List<NodeReport> nodesReport = client.getNodeReports( nodeStates.toArray(new NodeState[0])); writer.println("Total Nodes:" + nodesReport.size()); writer.printf(NODES_PATTERN, "Node-Id", "Node-State", "Node-Http-Address", "Number-of-Running-Containers"); for (NodeReport nodeReport : nodesReport) { writer.printf(NODES_PATTERN, nodeReport.getNodeId(), nodeReport .getNodeState(), nodeReport.getHttpAddress(), nodeReport .getNumContainers()); } writer.flush(); }
private void addSupervisorsRequest() { NodeReport[] availableNodes; try { Set<String> hosts = containers.stream().map(c -> c.getNodeId().getHost()).collect(Collectors.toSet()); hosts.addAll(requestingNodes); availableNodes = yarnClient.getNodeReports(NodeState.RUNNING).stream() .filter(n -> !hosts.contains(n.getNodeId().getHost())).toArray(NodeReport[]::new); } catch (Exception e) { LOG.warn("can not get node list", e); return; } int requiredNumSupervisors = numSupervisors.getAndSet(0); int num = Math.min(requiredNumSupervisors, availableNodes.length); LOG.info("Require {} supervisors, and {} nodes available", requiredNumSupervisors, availableNodes.length); for (int i = 0; i < num; i++) { String node = availableNodes[i].getNodeId().getHost(); requestingNodes.add(node); ContainerRequest req = new ContainerRequest(this.maxResourceCapability, new String[]{node}, // String[] nodes, null, // String[] racks, DEFAULT_PRIORITY, false); super.addContainerRequest(req); } }
private ClusterResourceDescription getCurrentFreeClusterResources(YarnClient yarnClient) throws YarnException, IOException { List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING); int totalFreeMemory = 0; int containerLimit = 0; int[] nodeManagersFree = new int[nodes.size()]; for (int i = 0; i < nodes.size(); i++) { NodeReport rep = nodes.get(i); int free = rep.getCapability().getMemory() - (rep.getUsed() != null ? rep.getUsed().getMemory() : 0); nodeManagersFree[i] = free; totalFreeMemory += free; if (free > containerLimit) { containerLimit = free; } } return new ClusterResourceDescription(totalFreeMemory, containerLimit, nodeManagersFree); }
private ClusterResourceDescription getCurrentFreeClusterResources(YarnClient yarnClient) throws YarnException, IOException { List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING); int totalFreeMemory = 0; int containerLimit = 0; int[] nodeManagersFree = new int[nodes.size()]; for (int i = 0; i < nodes.size(); i++) { NodeReport rep = nodes.get(i); int free = rep.getCapability().getMemory() - (rep.getUsed() != null ? rep.getUsed().getMemory() : 0); nodeManagersFree[i] = free; totalFreeMemory += free; if (free > containerLimit) { containerLimit = free; } } return new ClusterResourceDescription(totalFreeMemory, containerLimit, nodeManagersFree); }
private ClusterResourceDescription getCurrentFreeClusterResources( YarnClient yarnClient) throws YarnException, IOException { List<NodeReport> nodes = yarnClient.getNodeReports(NodeState.RUNNING); int totalFreeMemory = 0; int containerLimit = 0; int[] nodeManagersFree = new int[nodes.size()]; for (int i = 0; i < nodes.size(); i++) { NodeReport rep = nodes.get(i); int free = rep.getCapability().getMemory() - (rep.getUsed() != null ? rep. getUsed().getMemory() : 0); nodeManagersFree[i] = free; totalFreeMemory += free; if (free > containerLimit) { containerLimit = free; } } return new ClusterResourceDescription(totalFreeMemory, containerLimit, nodeManagersFree); }