Package io.trino.execution
Class SqlTaskManager
java.lang.Object
io.trino.execution.SqlTaskManager
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSqlTaskManager(VersionEmbedder versionEmbedder, ConnectorServicesProvider connectorServicesProvider, LocalExecutionPlanner planner, LanguageFunctionProvider languageFunctionProvider, LocationFactory locationFactory, TaskExecutor taskExecutor, SplitMonitor splitMonitor, io.airlift.node.NodeInfo nodeInfo, LocalMemoryManager localMemoryManager, TaskManagementExecutor taskManagementExecutor, TaskManagerConfig config, NodeMemoryConfig nodeMemoryConfig, LocalSpillManager localSpillManager, NodeSpillConfig nodeSpillConfig, io.airlift.stats.GcMonitor gcMonitor, io.opentelemetry.api.trace.Tracer tracer, ExchangeManagerRegistry exchangeManagerRegistry) SqlTaskManager(VersionEmbedder versionEmbedder, ConnectorServicesProvider connectorServicesProvider, LocalExecutionPlanner planner, LanguageFunctionProvider languageFunctionProvider, LocationFactory locationFactory, TaskExecutor taskExecutor, SplitMonitor splitMonitor, io.airlift.node.NodeInfo nodeInfo, LocalMemoryManager localMemoryManager, TaskManagementExecutor taskManagementExecutor, TaskManagerConfig config, NodeMemoryConfig nodeMemoryConfig, LocalSpillManager localSpillManager, NodeSpillConfig nodeSpillConfig, io.airlift.stats.GcMonitor gcMonitor, io.opentelemetry.api.trace.Tracer tracer, ExchangeManagerRegistry exchangeManagerRegistry, Predicate<List<StackTraceElement>> stuckSplitStackTracePredicate) -
Method Summary
Modifier and TypeMethodDescriptionAborts a task.acknowledgeAndGetNewDynamicFilterDomains(TaskId taskId, long currentDynamicFiltersVersion) voidacknowledgeTaskResults(TaskId taskId, PipelinedOutputBuffers.OutputBufferId bufferId, long sequenceId) Acknowledges previously received results.voidaddSourceTaskFailureListener(TaskId taskId, TaskFailureListener listener) Add a listener that notifies about failures of any source tasks for a given taskvoidaddStateChangeListener(TaskId taskId, StateMachine.StateChangeListener<TaskState> stateChangeListener) Adds a state change listener to the specified task.cancelTask(TaskId taskId) Cancels a task.voidclose()destroyTaskResults(TaskId taskId, PipelinedOutputBuffers.OutputBufferId bufferId) Aborts a result buffer for a task.voidFail a task.Gets all of the currently tracked tasks.io.airlift.stats.CounterStatgetQueryContext(QueryId queryId) getTaskInfo(TaskId taskId) Gets the info for the specified task.com.google.common.util.concurrent.ListenableFuture<TaskInfo> getTaskInfo(TaskId taskId, long currentVersion) Gets future info for the task after the state changes fromcurrent state.io.airlift.concurrent.ThreadPoolExecutorMBeangetTaskResults(TaskId taskId, PipelinedOutputBuffers.OutputBufferId bufferId, long startingSequenceId, io.airlift.units.DataSize maxSize) Gets results from a task either immediately or in the future.getTaskStatus(TaskId taskId) Gets the status for the specified task.com.google.common.util.concurrent.ListenableFuture<TaskStatus> getTaskStatus(TaskId taskId, long currentVersion) Gets future status for the task after the state changes fromcurrent state.getTraceToken(TaskId taskId) Return trace token for a given task (see Session#traceToken)voidpruneCatalogs(Set<CatalogHandle> activeCatalogs) voidstart()updateTask(Session session, TaskId taskId, io.opentelemetry.api.trace.Span stageSpan, Optional<PlanFragment> fragment, List<SplitAssignment> splitAssignments, OutputBuffers outputBuffers, Map<DynamicFilterId, Domain> dynamicFilterDomains, boolean speculative) Updates the task plan, splitAssignments and output buffers.
-
Constructor Details
-
SqlTaskManager
@Inject public SqlTaskManager(VersionEmbedder versionEmbedder, ConnectorServicesProvider connectorServicesProvider, LocalExecutionPlanner planner, LanguageFunctionProvider languageFunctionProvider, LocationFactory locationFactory, TaskExecutor taskExecutor, SplitMonitor splitMonitor, io.airlift.node.NodeInfo nodeInfo, LocalMemoryManager localMemoryManager, TaskManagementExecutor taskManagementExecutor, TaskManagerConfig config, NodeMemoryConfig nodeMemoryConfig, LocalSpillManager localSpillManager, NodeSpillConfig nodeSpillConfig, io.airlift.stats.GcMonitor gcMonitor, io.opentelemetry.api.trace.Tracer tracer, ExchangeManagerRegistry exchangeManagerRegistry) -
SqlTaskManager
public SqlTaskManager(VersionEmbedder versionEmbedder, ConnectorServicesProvider connectorServicesProvider, LocalExecutionPlanner planner, LanguageFunctionProvider languageFunctionProvider, LocationFactory locationFactory, TaskExecutor taskExecutor, SplitMonitor splitMonitor, io.airlift.node.NodeInfo nodeInfo, LocalMemoryManager localMemoryManager, TaskManagementExecutor taskManagementExecutor, TaskManagerConfig config, NodeMemoryConfig nodeMemoryConfig, LocalSpillManager localSpillManager, NodeSpillConfig nodeSpillConfig, io.airlift.stats.GcMonitor gcMonitor, io.opentelemetry.api.trace.Tracer tracer, ExchangeManagerRegistry exchangeManagerRegistry, Predicate<List<StackTraceElement>> stuckSplitStackTracePredicate)
-
-
Method Details
-
start
@PostConstruct public void start() -
close
@PreDestroy public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getIoStats
-
getTaskNotificationExecutor
public io.airlift.concurrent.ThreadPoolExecutorMBean getTaskNotificationExecutor() -
getFailedTasks
public io.airlift.stats.CounterStat getFailedTasks() -
getAllTasks
-
getAllTaskInfo
Gets all of the currently tracked tasks. This will included uninitialized, running, and completed tasks. -
getTaskInfo
Gets the info for the specified task. If the task has not been created yet, an uninitialized task is created and the info is returned.NOTE: this design assumes that only tasks that will eventually exist are queried.
-
getTaskStatus
Gets the status for the specified task. -
getTaskInfo
public com.google.common.util.concurrent.ListenableFuture<TaskInfo> getTaskInfo(TaskId taskId, long currentVersion) Gets future info for the task after the state changes fromcurrent state. If the task has not been created yet, an uninitialized task is created and the future is returned. If the task is already in a final state, the info is returned immediately.NOTE: this design assumes that only tasks that will eventually exist are queried.
-
getTaskStatus
public com.google.common.util.concurrent.ListenableFuture<TaskStatus> getTaskStatus(TaskId taskId, long currentVersion) Gets future status for the task after the state changes fromcurrent state. If the task has not been created yet, an uninitialized task is created and the future is returned. If the task is already in a final state, the status is returned immediately.NOTE: this design assumes that only tasks that will eventually exist are queried.
-
acknowledgeAndGetNewDynamicFilterDomains
public DynamicFiltersCollector.VersionedDynamicFilterDomains acknowledgeAndGetNewDynamicFilterDomains(TaskId taskId, long currentDynamicFiltersVersion) -
pruneCatalogs
-
updateTask
public TaskInfo updateTask(Session session, TaskId taskId, io.opentelemetry.api.trace.Span stageSpan, Optional<PlanFragment> fragment, List<SplitAssignment> splitAssignments, OutputBuffers outputBuffers, Map<DynamicFilterId, Domain> dynamicFilterDomains, boolean speculative) Updates the task plan, splitAssignments and output buffers. If the task does not already exist, it is created and then updated. -
getTaskResults
public SqlTaskManager.SqlTaskWithResults getTaskResults(TaskId taskId, PipelinedOutputBuffers.OutputBufferId bufferId, long startingSequenceId, io.airlift.units.DataSize maxSize) Gets results from a task either immediately or in the future. If the task or buffer has not been created yet, an uninitialized task is created and a future is returned.NOTE: this design assumes that only tasks and buffers that will eventually exist are queried.
-
acknowledgeTaskResults
public void acknowledgeTaskResults(TaskId taskId, PipelinedOutputBuffers.OutputBufferId bufferId, long sequenceId) Acknowledges previously received results. -
destroyTaskResults
Aborts a result buffer for a task. If the task or buffer has not been created yet, an uninitialized task is created and a the buffer is aborted.NOTE: this design assumes that only tasks and buffers that will eventually exist are queried.
-
cancelTask
Cancels a task. If the task does not already exist, it is created and then canceled. -
abortTask
Aborts a task. If the task does not already exist, it is created and then aborted. -
failTask
Fail a task. If the task does not already exist, it is created and then failed. -
addStateChangeListener
public void addStateChangeListener(TaskId taskId, StateMachine.StateChangeListener<TaskState> stateChangeListener) Adds a state change listener to the specified task. Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leakingthiswhen adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution. -
addSourceTaskFailureListener
Add a listener that notifies about failures of any source tasks for a given task -
getTraceToken
Return trace token for a given task (see Session#traceToken) -
getQueryContext
-
failStuckSplitTasks
public void failStuckSplitTasks()
-