Search in sources :

Example 1 with TaskHandle

use of io.trino.execution.executor.TaskHandle in project trino by trinodb.

the class SqlTaskExecution method createTaskHandle.

// this is a separate method to ensure that the `this` reference is not leaked during construction
private static TaskHandle createTaskHandle(TaskStateMachine taskStateMachine, TaskContext taskContext, OutputBuffer outputBuffer, LocalExecutionPlan localExecutionPlan, TaskExecutor taskExecutor) {
    TaskHandle taskHandle = taskExecutor.addTask(taskStateMachine.getTaskId(), outputBuffer::getUtilization, getInitialSplitsPerNode(taskContext.getSession()), getSplitConcurrencyAdjustmentInterval(taskContext.getSession()), getMaxDriversPerTask(taskContext.getSession()));
    taskStateMachine.addStateChangeListener(state -> {
        if (state.isDone()) {
            taskExecutor.removeTask(taskHandle);
            for (DriverFactory factory : localExecutionPlan.getDriverFactories()) {
                factory.noMoreDrivers();
            }
        }
    });
    return taskHandle;
}
Also used : DriverFactory(io.trino.operator.DriverFactory) TaskHandle(io.trino.execution.executor.TaskHandle)

Aggregations

TaskHandle (io.trino.execution.executor.TaskHandle)1 DriverFactory (io.trino.operator.DriverFactory)1