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

The following examples show how to use org.apache.hadoop.yarn.api.records.QueueInfo#getCapacity() . 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: FifoSchedulerInfo.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public FifoSchedulerInfo(final ResourceManager rm) {

    RMContext rmContext = rm.getRMContext();

    FifoScheduler fs = (FifoScheduler) rm.getResourceScheduler();
    qName = fs.getQueueInfo("", false, false).getQueueName();
    QueueInfo qInfo = fs.getQueueInfo(qName, true, true);

    this.usedCapacity = qInfo.getCurrentCapacity();
    this.capacity = qInfo.getCapacity();
    this.minQueueMemoryCapacity = fs.getMinimumResourceCapability().getMemory();
    this.maxQueueMemoryCapacity = fs.getMaximumResourceCapability().getMemory();
    this.qstate = qInfo.getQueueState();

    this.numNodes = rmContext.getRMNodes().size();
    this.usedNodeCapacity = 0;
    this.availNodeCapacity = 0;
    this.totalNodeCapacity = 0;
    this.numContainers = 0;

    for (RMNode ni : rmContext.getRMNodes().values()) {
      SchedulerNodeReport report = fs.getNodeReport(ni.getNodeID());
      this.usedNodeCapacity += report.getUsedResource().getMemory();
      this.availNodeCapacity += report.getAvailableResource().getMemory();
      this.totalNodeCapacity += ni.getTotalCapability().getMemory();
      this.numContainers += fs.getNodeReport(ni.getNodeID()).getNumContainers();
    }
  }
 
Example 3
Source File: FifoSchedulerInfo.java    From big-c with Apache License 2.0 5 votes vote down vote up
public FifoSchedulerInfo(final ResourceManager rm) {

    RMContext rmContext = rm.getRMContext();

    FifoScheduler fs = (FifoScheduler) rm.getResourceScheduler();
    qName = fs.getQueueInfo("", false, false).getQueueName();
    QueueInfo qInfo = fs.getQueueInfo(qName, true, true);

    this.usedCapacity = qInfo.getCurrentCapacity();
    this.capacity = qInfo.getCapacity();
    this.minQueueMemoryCapacity = fs.getMinimumResourceCapability().getMemory();
    this.maxQueueMemoryCapacity = fs.getMaximumResourceCapability().getMemory();
    this.qstate = qInfo.getQueueState();

    this.numNodes = rmContext.getRMNodes().size();
    this.usedNodeCapacity = 0;
    this.availNodeCapacity = 0;
    this.totalNodeCapacity = 0;
    this.numContainers = 0;

    for (RMNode ni : rmContext.getRMNodes().values()) {
      SchedulerNodeReport report = fs.getNodeReport(ni.getNodeID());
      this.usedNodeCapacity += report.getUsedResource().getMemory();
      this.availNodeCapacity += report.getAvailableResource().getMemory();
      this.totalNodeCapacity += ni.getTotalCapability().getMemory();
      this.numContainers += fs.getNodeReport(ni.getNodeID()).getNumContainers();
    }
  }