Interface TaskManager

All Known Implementing Classes:
SqlTaskManager

public interface TaskManager
  • Method Details

    • getAllTaskInfo

      List<TaskInfo> getAllTaskInfo()
      Gets all of the currently tracked tasks. This will included uninitialized, running, and completed tasks.
    • getTaskInfo

      TaskInfo getTaskInfo(TaskId taskId)
      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

      TaskStatus getTaskStatus(TaskId taskId)
      Gets the status for the specified task.
    • getTaskInfo

      com.google.common.util.concurrent.ListenableFuture<TaskInfo> getTaskInfo(TaskId taskId, long currentVersion)
      Gets future info for the task after the state changes from current 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.

    • getTaskInstanceId

      String getTaskInstanceId(TaskId taskId)
      Gets the unique instance id of a task. This can be used to detect a task that was destroyed and recreated.
    • getTaskStatus

      com.google.common.util.concurrent.ListenableFuture<TaskStatus> getTaskStatus(TaskId taskId, long currentVersion)
      Gets future status for the task after the state changes from current 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

      DynamicFiltersCollector.VersionedDynamicFilterDomains acknowledgeAndGetNewDynamicFilterDomains(TaskId taskId, long currentDynamicFiltersVersion)
    • updateMemoryPoolAssignments

      void updateMemoryPoolAssignments(MemoryPoolAssignmentsRequest assignments)
    • updateTask

      TaskInfo 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. If the task does not already exist, it is created and then updated.
    • cancelTask

      TaskInfo cancelTask(TaskId taskId)
      Cancels a task. If the task does not already exist, it is created and then canceled.
    • abortTask

      TaskInfo abortTask(TaskId taskId)
      Aborts a task. If the task does not already exist, it is created and then aborted.
    • failTask

      TaskInfo failTask(TaskId taskId, Throwable failure)
      Fail a task. If the task does not already exist, it is created and then failed.
    • getTaskResults

      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. 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

      void acknowledgeTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId, long sequenceId)
      Acknowledges previously received results.
    • abortTaskResults

      TaskInfo abortTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId)
      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.

    • addStateChangeListener

      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 leaking this when adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution.
    • addSourceTaskFailureListener

      void addSourceTaskFailureListener(TaskId taskId, TaskFailureListener listener)
      Add a listener that notifies about failures of any source tasks for a given task
    • getTraceToken

      Optional<String> getTraceToken(TaskId taskId)
      Return trace token for a given task (see Session#traceToken)