Search in sources :

Example 1 with QueueSelectionException

use of org.apache.drill.exec.resourcemgr.config.exception.QueueSelectionException in project drill by apache.

the class BestFitQueueSelection method selectQueue.

@Override
public ResourcePool selectQueue(List<ResourcePool> allPools, QueryContext queryContext, NodeResources maxResourcePerNode) throws QueueSelectionException {
    if (allPools.isEmpty()) {
        throw new QueueSelectionException(String.format("There are no pools to apply %s selection policy pool for the " + "query: %s", getSelectionPolicy().toString(), queryContext.getQueryId()));
    }
    allPools.sort(new BestFitComparator());
    final long queryMaxNodeMemory = maxResourcePerNode.getMemoryInMB();
    ResourcePool selectedPool = allPools.get(0);
    for (ResourcePool pool : allPools) {
        selectedPool = pool;
        long poolMaxNodeMem = pool.getQueryQueue().getMaxQueryMemoryInMBPerNode();
        if (poolMaxNodeMem >= queryMaxNodeMemory) {
            break;
        }
    }
    logger.debug("Selected pool {} based on {} policy for query {}", selectedPool.getPoolName(), getSelectionPolicy().toString(), queryContext.getQueryId());
    return selectedPool;
}
Also used : QueueSelectionException(org.apache.drill.exec.resourcemgr.config.exception.QueueSelectionException) ResourcePool(org.apache.drill.exec.resourcemgr.config.ResourcePool)

Example 2 with QueueSelectionException

use of org.apache.drill.exec.resourcemgr.config.exception.QueueSelectionException in project drill by apache.

the class RandomQueueSelection method selectQueue.

@Override
public ResourcePool selectQueue(List<ResourcePool> allPools, QueryContext queryContext, NodeResources maxResourcePerNode) throws QueueSelectionException {
    if (allPools.size() == 0) {
        throw new QueueSelectionException(String.format("Input pool list is empty to apply %s selection policy", getSelectionPolicy().toString()));
    }
    Collections.shuffle(allPools);
    ResourcePool selectedPool = allPools.get(0);
    logger.debug("Selected random pool: {} for query: {}", selectedPool.getPoolName(), queryContext.getQueryId());
    return selectedPool;
}
Also used : QueueSelectionException(org.apache.drill.exec.resourcemgr.config.exception.QueueSelectionException) ResourcePool(org.apache.drill.exec.resourcemgr.config.ResourcePool)

Aggregations

ResourcePool (org.apache.drill.exec.resourcemgr.config.ResourcePool)2 QueueSelectionException (org.apache.drill.exec.resourcemgr.config.exception.QueueSelectionException)2