Search in sources :

Example 1 with TaskHandle

use of com.facebook.presto.execution.executor.TaskHandle in project presto by prestodb.

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(com.facebook.presto.operator.DriverFactory) TaskHandle(com.facebook.presto.execution.executor.TaskHandle)

Example 2 with TaskHandle

use of com.facebook.presto.execution.executor.TaskHandle in project presto by prestodb.

the class PrestoSparkTaskExecution 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, LocalExecutionPlan localExecutionPlan, TaskExecutor taskExecutor) {
    TaskHandle taskHandle = taskExecutor.addTask(taskStateMachine.getTaskId(), () -> 0, 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(com.facebook.presto.operator.DriverFactory) TaskHandle(com.facebook.presto.execution.executor.TaskHandle)

Aggregations

TaskHandle (com.facebook.presto.execution.executor.TaskHandle)2 DriverFactory (com.facebook.presto.operator.DriverFactory)2