Java Code Examples for org.apache.hadoop.yarn.api.records.QueueInfo#getChildQueues()

The following examples show how to use org.apache.hadoop.yarn.api.records.QueueInfo#getChildQueues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AlertGenerator.java    From jumbune with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 	 * Traverse queues bf.
 	 *
 	 * @param queueName the queue name
 	 * @param queueAlert the queue alert
* @param rmCommunicator 
 	 * @throws YarnException the yarn exception
 	 * @throws IOException Signals that an I/O exception has occurred.
 	 */
 	private void traverseQueuesBF(String queueName, List<AlertInfo> queueAlert, RMCommunicator rmCommunicator) throws YarnException, IOException {
   final String parentQueue = queueName;
   QueueInfo qi = rmCommunicator.getQueueInfo(queueName);
      List<String> queueNames = new ArrayList<String>(5); 
   float childrenCapacity = 0.0f;
   for (QueueInfo info : qi.getChildQueues()) {
	   queueNames.add(info.getQueueName());
	   childrenCapacity += info.getCapacity();
   }
	if(childrenCapacity > 1.0){
		AlertInfo alertInfo = new AlertInfo (ExtendedConstants.WARNING_LEVEL,ExtendedConstants.HYPHEN,"Queue "+parentQueue+":"+"child capacity exceeded 100 percent", getDate());
		queueAlert.add(alertInfo);
	}
   for(String name : queueNames) {
	   traverseQueuesBF(name, queueAlert, rmCommunicator);
   }
   
  }
 
Example 2
Source File: YarnClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void getChildQueues(QueueInfo parent, List<QueueInfo> queues,
    boolean recursive) {
  List<QueueInfo> childQueues = parent.getChildQueues();

  for (QueueInfo child : childQueues) {
    queues.add(child);
    if (recursive) {
      getChildQueues(child, queues, recursive);
    }
  }
}
 
Example 3
Source File: YarnClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void getChildQueues(QueueInfo parent, List<QueueInfo> queues,
    boolean recursive) {
  List<QueueInfo> childQueues = parent.getChildQueues();

  for (QueueInfo child : childQueues) {
    queues.add(child);
    if (recursive) {
      getChildQueues(child, queues, recursive);
    }
  }
}
 
Example 4
Source File: AdminConfigurationService.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addQueue(QueueInfo queueInfo, List<String> list) {
	list.add(queueInfo.getQueueName());
	if (queueInfo.getChildQueues() != null) {
		for (QueueInfo childQueue : queueInfo.getChildQueues()) {
			addQueue(childQueue, list);
		}
	}
}
 
Example 5
Source File: AdminConfigurationService.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addLeafQueue(QueueInfo queueInfo, List<String> list) {
	
	if (queueInfo.getChildQueues() == null || queueInfo.getChildQueues().size() == 0) {
		// If leaf queue then
		list.add(queueInfo.getQueueName());
	} else {
		// If not leaf queue
		for (QueueInfo childQueue : queueInfo.getChildQueues()) {
			addLeafQueue(childQueue, list);
		}
	}
}
 
Example 6
Source File: AlertGenerator.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addQueue(QueueInfo queueInfo, List<QueueInfo> list) {
	list.add(queueInfo);
	if (queueInfo.getChildQueues() != null) {
		for (QueueInfo childQueue : queueInfo.getChildQueues()) {
			addQueue(childQueue, list);
		}
	}
}
 
Example 7
Source File: ClusterProfilingHelper.java    From jumbune with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Populate queue stats.
 *
 * @param cluster the cluster
 * @return the list
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws InterruptedException the interrupted exception
 */
public List<QueueStats> getQueueStats(String clusterName, RMCommunicator rmCommunicator) throws IOException, InterruptedException {
	List<QueueStats> queueInformation = new ArrayList<QueueStats>();
	QueueInfo queueInfo;
	try {
		queueInfo = rmCommunicator.getQueueInfo(ROOT);
		Stack<QueueInfo> stack = new Stack<QueueInfo>();
		stack.push(queueInfo);
		QueueInfo temp;
		List<QueueInfo> list = null;

		while (!stack.isEmpty()){
			temp = stack.pop();
			YarnQueueStats yarnQueueStats = new YarnQueueStats();
			if(!temp.getQueueName().equals(ROOT)){
				yarnQueueStats.setQueueName(temp.getQueueName());
				if (Constants.CLOUDERA.equals(FileUtil.getClusterInfoDetail(Constants.HADOOP_DISTRIBUTION))
						|| Constants.MAPR.equals(FileUtil.getClusterInfoDetail(Constants.HADOOP_DISTRIBUTION))
						|| Constants.EMRMAPR.equals(FileUtil.getClusterInfoDetail(Constants.HADOOP_DISTRIBUTION))){//mapr code changes
					yarnQueueStats.setMaximumCapacity(temp.getCapacity()*100);
					yarnQueueStats.setCapacity(temp.getCapacity()*100);
					yarnQueueStats.setCurrentCapacity(temp.getCurrentCapacity()*100);
				}else{
					yarnQueueStats.setMaximumCapacity(temp.getMaximumCapacity()*100);
					yarnQueueStats.setCapacity(temp.getCapacity()*100);
					yarnQueueStats.setCurrentCapacity(temp.getCurrentCapacity()*100);
				}
				queueInformation.add(yarnQueueStats);
			}
			list = temp.getChildQueues();
			if (list != null && !list.isEmpty()) {
				Iterator<QueueInfo> it = list.iterator();
				while (it.hasNext()) {
					stack.push(it.next());
				}
			}
			yarnQueueStats =null;
		}
		return queueInformation;
	} catch (YarnException e) {
		LOGGER.error(JumbuneRuntimeException.throwYarnException(e.getStackTrace()));
	}
	return queueInformation;

}