use of com.facebook.presto.operator.DriverFactory 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;
}
Aggregations