Package io.trino.execution
Class SqlTaskManager
java.lang.Object
io.trino.execution.SqlTaskManager
- All Implemented Interfaces:
TaskManager,Closeable,AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionSqlTaskManager(VersionEmbedder versionEmbedder, LocalExecutionPlanner planner, 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) -
Method Summary
Modifier and TypeMethodDescriptionAborts a task.abortTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId) Aborts a result buffer for a task.acknowledgeAndGetNewDynamicFilterDomains(TaskId taskId, long currentDynamicFiltersVersion) voidacknowledgeTaskResults(TaskId taskId, OutputBuffers.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()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.getTaskInstanceId(TaskId taskId) Gets the unique instance id of a task.io.airlift.concurrent.ThreadPoolExecutorMBeancom.google.common.util.concurrent.ListenableFuture<BufferResult>getTaskResults(TaskId taskId, OutputBuffers.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)voidvoidstart()voidupdateMemoryPoolAssignments(MemoryPoolAssignmentsRequest assignments) updateTask(Session session, TaskId taskId, Optional<PlanFragment> fragment, List<TaskSource> sources, OutputBuffers outputBuffers, Map<DynamicFilterId, Domain> dynamicFilterDomains) Updates the task plan, sources and output buffers.
-
Constructor Details
-
SqlTaskManager
@Inject public SqlTaskManager(VersionEmbedder versionEmbedder, LocalExecutionPlanner planner, 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)
-
-
Method Details
-
updateMemoryPoolAssignments
- Specified by:
updateMemoryPoolAssignmentsin interfaceTaskManager
-
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
Description copied from interface:TaskManagerGets all of the currently tracked tasks. This will included uninitialized, running, and completed tasks.- Specified by:
getAllTaskInfoin interfaceTaskManager
-
getTaskInfo
Description copied from interface:TaskManagerGets 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.
- Specified by:
getTaskInfoin interfaceTaskManager
-
getTaskStatus
Description copied from interface:TaskManagerGets the status for the specified task.- Specified by:
getTaskStatusin interfaceTaskManager
-
getTaskInfo
public com.google.common.util.concurrent.ListenableFuture<TaskInfo> getTaskInfo(TaskId taskId, long currentVersion) Description copied from interface:TaskManagerGets 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.
- Specified by:
getTaskInfoin interfaceTaskManager
-
getTaskInstanceId
Description copied from interface:TaskManagerGets the unique instance id of a task. This can be used to detect a task that was destroyed and recreated.- Specified by:
getTaskInstanceIdin interfaceTaskManager
-
getTaskStatus
public com.google.common.util.concurrent.ListenableFuture<TaskStatus> getTaskStatus(TaskId taskId, long currentVersion) Description copied from interface:TaskManagerGets 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.
- Specified by:
getTaskStatusin interfaceTaskManager
-
acknowledgeAndGetNewDynamicFilterDomains
public DynamicFiltersCollector.VersionedDynamicFilterDomains acknowledgeAndGetNewDynamicFilterDomains(TaskId taskId, long currentDynamicFiltersVersion) - Specified by:
acknowledgeAndGetNewDynamicFilterDomainsin interfaceTaskManager
-
updateTask
public TaskInfo updateTask(Session session, TaskId taskId, Optional<PlanFragment> fragment, List<TaskSource> sources, OutputBuffers outputBuffers, Map<DynamicFilterId, Domain> dynamicFilterDomains) Description copied from interface:TaskManagerUpdates the task plan, sources and output buffers. If the task does not already exist, it is created and then updated.- Specified by:
updateTaskin interfaceTaskManager
-
getTaskResults
public com.google.common.util.concurrent.ListenableFuture<BufferResult> getTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId, long startingSequenceId, io.airlift.units.DataSize maxSize) Description copied from interface:TaskManagerGets 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.
- Specified by:
getTaskResultsin interfaceTaskManager
-
acknowledgeTaskResults
public void acknowledgeTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId, long sequenceId) Description copied from interface:TaskManagerAcknowledges previously received results.- Specified by:
acknowledgeTaskResultsin interfaceTaskManager
-
abortTaskResults
Description copied from interface:TaskManagerAborts 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.
- Specified by:
abortTaskResultsin interfaceTaskManager
-
cancelTask
Description copied from interface:TaskManagerCancels a task. If the task does not already exist, it is created and then canceled.- Specified by:
cancelTaskin interfaceTaskManager
-
abortTask
Description copied from interface:TaskManagerAborts a task. If the task does not already exist, it is created and then aborted.- Specified by:
abortTaskin interfaceTaskManager
-
failTask
Description copied from interface:TaskManagerFail a task. If the task does not already exist, it is created and then failed.- Specified by:
failTaskin interfaceTaskManager
-
removeOldTasks
public void removeOldTasks() -
failAbandonedTasks
public void failAbandonedTasks() -
addStateChangeListener
public void addStateChangeListener(TaskId taskId, StateMachine.StateChangeListener<TaskState> stateChangeListener) Description copied from interface:TaskManagerAdds 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.- Specified by:
addStateChangeListenerin interfaceTaskManager
-
addSourceTaskFailureListener
Description copied from interface:TaskManagerAdd a listener that notifies about failures of any source tasks for a given task- Specified by:
addSourceTaskFailureListenerin interfaceTaskManager
-
getTraceToken
Description copied from interface:TaskManagerReturn trace token for a given task (see Session#traceToken)- Specified by:
getTraceTokenin interfaceTaskManager
-
getQueryContext
-