Search in sources :

Example 1 with ResourceAwareSchedulingStrategy

use of com.facebook.presto.execution.scheduler.NodeSchedulerConfig.ResourceAwareSchedulingStrategy in project presto by prestodb.

the class NodeScheduler method createNodeSelector.

public NodeSelector createNodeSelector(Session session, ConnectorId connectorId, int maxTasksPerStage) {
    // this supplier is thread-safe. TODO: this logic should probably move to the scheduler since the choice of which node to run in should be
    // done as close to when the the split is about to be scheduled
    Supplier<NodeMap> nodeMap = nodeMapRefreshInterval.toMillis() > 0 ? memoizeWithExpiration(createNodeMapSupplier(connectorId), nodeMapRefreshInterval.toMillis(), MILLISECONDS) : createNodeMapSupplier(connectorId);
    int maxUnacknowledgedSplitsPerTask = getMaxUnacknowledgedSplitsPerTask(requireNonNull(session, "session is null"));
    ResourceAwareSchedulingStrategy resourceAwareSchedulingStrategy = getResourceAwareSchedulingStrategy(session);
    if (useNetworkTopology) {
        return new TopologyAwareNodeSelector(nodeManager, nodeSelectionStats, nodeTaskMap, includeCoordinator, nodeMap, minCandidates, maxSplitsWeightPerNode, maxPendingSplitsWeightPerTask, maxUnacknowledgedSplitsPerTask, topologicalSplitCounters, networkLocationSegmentNames, networkLocationCache, nodeSelectionHashStrategy);
    }
    SimpleNodeSelector simpleNodeSelector = new SimpleNodeSelector(nodeManager, nodeSelectionStats, nodeTaskMap, includeCoordinator, nodeMap, minCandidates, maxSplitsWeightPerNode, maxPendingSplitsWeightPerTask, maxUnacknowledgedSplitsPerTask, maxTasksPerStage, nodeSelectionHashStrategy);
    if (resourceAwareSchedulingStrategy == TTL) {
        return new SimpleTtlNodeSelector(simpleNodeSelector, simpleTtlNodeSelectorConfig, nodeTaskMap, nodeMap, minCandidates, includeCoordinator, maxSplitsWeightPerNode, maxPendingSplitsWeightPerTask, maxTasksPerStage, nodeTtlFetcherManager, queryManager, session);
    }
    return simpleNodeSelector;
}
Also used : SimpleTtlNodeSelector(com.facebook.presto.execution.scheduler.nodeSelection.SimpleTtlNodeSelector) TopologyAwareNodeSelector(com.facebook.presto.execution.scheduler.nodeSelection.TopologyAwareNodeSelector) SimpleNodeSelector(com.facebook.presto.execution.scheduler.nodeSelection.SimpleNodeSelector) SystemSessionProperties.getResourceAwareSchedulingStrategy(com.facebook.presto.SystemSessionProperties.getResourceAwareSchedulingStrategy) ResourceAwareSchedulingStrategy(com.facebook.presto.execution.scheduler.NodeSchedulerConfig.ResourceAwareSchedulingStrategy)

Aggregations

SystemSessionProperties.getResourceAwareSchedulingStrategy (com.facebook.presto.SystemSessionProperties.getResourceAwareSchedulingStrategy)1 ResourceAwareSchedulingStrategy (com.facebook.presto.execution.scheduler.NodeSchedulerConfig.ResourceAwareSchedulingStrategy)1 SimpleNodeSelector (com.facebook.presto.execution.scheduler.nodeSelection.SimpleNodeSelector)1 SimpleTtlNodeSelector (com.facebook.presto.execution.scheduler.nodeSelection.SimpleTtlNodeSelector)1 TopologyAwareNodeSelector (com.facebook.presto.execution.scheduler.nodeSelection.TopologyAwareNodeSelector)1