Package io.trino.execution
Class SqlTaskManager
- java.lang.Object
-
- io.trino.execution.SqlTaskManager
-
- All Implemented Interfaces:
TaskManager,Closeable,AutoCloseable
public class SqlTaskManager extends Object implements TaskManager, Closeable
-
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaskInfoabortTask(TaskId taskId)Aborts a task.TaskInfoabortTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId)Aborts a result buffer for a task.DynamicFiltersCollector.VersionedDynamicFilterDomainsacknowledgeAndGetNewDynamicFilterDomains(TaskId taskId, long currentDynamicFiltersVersion)voidacknowledgeTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId, long sequenceId)Acknowledges previously received results.voidaddStateChangeListener(TaskId taskId, StateMachine.StateChangeListener<TaskState> stateChangeListener)Adds a state change listener to the specified task.TaskInfocancelTask(TaskId taskId)Cancels a task.voidclose()voidfailAbandonedTasks()List<TaskInfo>getAllTaskInfo()Gets all of the currently tracked tasks.List<SqlTask>getAllTasks()io.airlift.stats.CounterStatgetFailedTasks()SqlTaskIoStatsgetIoStats()QueryContextgetQueryContext(QueryId queryId)TaskInfogetTaskInfo(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.StringgetTaskInstanceId(TaskId taskId)Gets the unique instance id of a task.io.airlift.concurrent.ThreadPoolExecutorMBeangetTaskNotificationExecutor()com.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.TaskStatusgetTaskStatus(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.voidremoveOldTasks()voidstart()voidupdateMemoryPoolAssignments(MemoryPoolAssignmentsRequest assignments)TaskInfoupdateTask(Session session, TaskId taskId, Optional<PlanFragment> fragment, List<TaskSource> sources, OutputBuffers outputBuffers, OptionalInt totalPartitions)Updates the task plan, sources and output buffers.
-
-
-
Constructor Detail
-
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 Detail
-
updateMemoryPoolAssignments
public void updateMemoryPoolAssignments(MemoryPoolAssignmentsRequest assignments)
- Specified by:
updateMemoryPoolAssignmentsin interfaceTaskManager
-
start
@PostConstruct public void start()
-
close
@PreDestroy public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getIoStats
public SqlTaskIoStats getIoStats()
-
getTaskNotificationExecutor
public io.airlift.concurrent.ThreadPoolExecutorMBean getTaskNotificationExecutor()
-
getFailedTasks
public io.airlift.stats.CounterStat getFailedTasks()
-
getAllTaskInfo
public List<TaskInfo> 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
public TaskInfo getTaskInfo(TaskId taskId)
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
public TaskStatus getTaskStatus(TaskId taskId)
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
public String getTaskInstanceId(TaskId taskId)
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, OptionalInt totalPartitions)
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
public TaskInfo abortTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId)
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
public TaskInfo cancelTask(TaskId taskId)
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
public TaskInfo abortTask(TaskId taskId)
Description copied from interface:TaskManagerAborts a task. If the task does not already exist, it is created and then aborted.- Specified by:
abortTaskin 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
-
getQueryContext
public QueryContext getQueryContext(QueryId queryId)
-
-