Search in sources :

Example 1 with ResourceGroupState

use of com.facebook.presto.spi.resourceGroups.ResourceGroupState in project presto by prestodb.

the class InternalResourceGroup method getInfo.

public ResourceGroupInfo getInfo() {
    synchronized (root) {
        checkState(!subGroups.isEmpty() || (descendantRunningQueries == 0 && descendantQueuedQueries == 0), "Leaf resource group has descendant queries.");
        List<ResourceGroupInfo> infos = subGroups.values().stream().map(InternalResourceGroup::getInfo).collect(toImmutableList());
        ResourceGroupState resourceGroupState;
        if (canRunMore()) {
            resourceGroupState = CAN_RUN;
        } else if (canQueueMore()) {
            resourceGroupState = CAN_QUEUE;
        } else {
            resourceGroupState = FULL;
        }
        return new ResourceGroupInfo(id, new DataSize(softMemoryLimitBytes, BYTE), maxRunningQueries, maxQueuedQueries, resourceGroupState, eligibleSubGroups.size(), new DataSize(cachedMemoryUsageBytes, BYTE), runningQueries.size() + descendantRunningQueries, queuedQueries.size() + descendantQueuedQueries, infos);
    }
}
Also used : ResourceGroupState(com.facebook.presto.spi.resourceGroups.ResourceGroupState) DataSize(io.airlift.units.DataSize) ResourceGroupInfo(com.facebook.presto.spi.resourceGroups.ResourceGroupInfo)

Aggregations

ResourceGroupInfo (com.facebook.presto.spi.resourceGroups.ResourceGroupInfo)1 ResourceGroupState (com.facebook.presto.spi.resourceGroups.ResourceGroupState)1 DataSize (io.airlift.units.DataSize)1