use of com.facebook.presto.execution.scheduler.nodeSelection.TopologyAwareNodeSelector 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;
}
Aggregations