Search in sources :

Example 6 with NodeScheduler

use of io.trino.execution.scheduler.NodeScheduler in project trino by trinodb.

the class TestNodeScheduler method setUp.

@BeforeMethod
public void setUp() {
    session = TestingSession.testSessionBuilder().build();
    finalizerService = new FinalizerService();
    nodeTaskMap = new NodeTaskMap(finalizerService);
    nodeManager = new InMemoryNodeManager();
    nodeSchedulerConfig = new NodeSchedulerConfig().setMaxSplitsPerNode(20).setIncludeCoordinator(false).setMaxPendingSplitsPerTask(10);
    nodeScheduler = new NodeScheduler(new UniformNodeSelectorFactory(nodeManager, nodeSchedulerConfig, nodeTaskMap));
    // contents of taskMap indicate the node-task map for the current stage
    taskMap = new HashMap<>();
    nodeSelector = nodeScheduler.createNodeSelector(session, Optional.of(CONNECTOR_ID));
    remoteTaskExecutor = newCachedThreadPool(daemonThreadsNamed("remoteTaskExecutor-%s"));
    remoteTaskScheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("remoteTaskScheduledExecutor-%s"));
    finalizerService.start();
}
Also used : FinalizerService(io.trino.util.FinalizerService) UniformNodeSelectorFactory(io.trino.execution.scheduler.UniformNodeSelectorFactory) NodeSchedulerConfig(io.trino.execution.scheduler.NodeSchedulerConfig) NodeScheduler(io.trino.execution.scheduler.NodeScheduler) InMemoryNodeManager(io.trino.metadata.InMemoryNodeManager) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 7 with NodeScheduler

use of io.trino.execution.scheduler.NodeScheduler in project trino by trinodb.

the class TestHashJoinOperator method setUp.

@BeforeMethod
public void setUp() {
    // Before/AfterMethod is chosen here because the executor needs to be shutdown
    // after every single test case to terminate outstanding threads, if any.
    // The line below is the same as newCachedThreadPool(daemonThreadsNamed(...)) except RejectionExecutionHandler.
    // RejectionExecutionHandler is set to DiscardPolicy (instead of the default AbortPolicy) here.
    // Otherwise, a large number of RejectedExecutionException will flood logging, resulting in Travis failure.
    executor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, SECONDS, new SynchronousQueue<>(), daemonThreadsNamed("test-executor-%s"), new ThreadPoolExecutor.DiscardPolicy());
    scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed(getClass().getSimpleName() + "-scheduledExecutor-%s"));
    NodeScheduler nodeScheduler = new NodeScheduler(new UniformNodeSelectorFactory(new InMemoryNodeManager(), new NodeSchedulerConfig().setIncludeCoordinator(true), new NodeTaskMap(new FinalizerService())));
    nodePartitioningManager = new NodePartitioningManager(nodeScheduler, new BlockTypeOperators(new TypeOperators()));
}
Also used : BlockTypeOperators(io.trino.type.BlockTypeOperators) NodeTaskMap(io.trino.execution.NodeTaskMap) FinalizerService(io.trino.util.FinalizerService) UniformNodeSelectorFactory(io.trino.execution.scheduler.UniformNodeSelectorFactory) SynchronousQueue(java.util.concurrent.SynchronousQueue) NodeScheduler(io.trino.execution.scheduler.NodeScheduler) NodeSchedulerConfig(io.trino.execution.scheduler.NodeSchedulerConfig) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) NodePartitioningManager(io.trino.sql.planner.NodePartitioningManager) InMemoryNodeManager(io.trino.metadata.InMemoryNodeManager) TypeOperators(io.trino.spi.type.TypeOperators) BlockTypeOperators(io.trino.type.BlockTypeOperators) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

NodeScheduler (io.trino.execution.scheduler.NodeScheduler)7 NodeSchedulerConfig (io.trino.execution.scheduler.NodeSchedulerConfig)6 UniformNodeSelectorFactory (io.trino.execution.scheduler.UniformNodeSelectorFactory)5 InMemoryNodeManager (io.trino.metadata.InMemoryNodeManager)5 BlockTypeOperators (io.trino.type.BlockTypeOperators)5 FinalizerService (io.trino.util.FinalizerService)5 NodePartitioningManager (io.trino.sql.planner.NodePartitioningManager)4 ImmutableList (com.google.common.collect.ImmutableList)3 NodeTaskMap (io.trino.execution.NodeTaskMap)3 Split (io.trino.metadata.Split)3 TypeOperators (io.trino.spi.type.TypeOperators)3 List (java.util.List)3 CatalogName (io.trino.connector.CatalogName)2 SplitMonitor (io.trino.event.SplitMonitor)2 IndexManager (io.trino.index.IndexManager)2 PagesIndex (io.trino.operator.PagesIndex)2 TrinoOperatorFactories (io.trino.operator.TrinoOperatorFactories)2 IndexJoinLookupStats (io.trino.operator.index.IndexJoinLookupStats)2 Type (io.trino.spi.type.Type)2 GenericSpillerFactory (io.trino.spiller.GenericSpillerFactory)2