Class PipelinedStageExecution
- All Implemented Interfaces:
StageExecution
In the pipeline mode the tasks are executed in all-or-nothing fashion with all the intermediate data being "piped" between stages in a streaming way.
This class has two main responsibilities:
1. Linking pipelined stages together. If a new task is scheduled the implementation notifies upstream stages to add an additional output buffer for the task as well as it notifies the downstream stage to update a list of source tasks. It is also responsible of notifying both upstream and downstream stages when no more tasks will be added.
2. Facilitates state transitioning for a pipelined stage execution according to the all-or-noting model. If any of the tasks fail the implementation is responsible for terminating all remaining tasks as well as propagating the original error. If all the tasks finish successfully the implementation is responsible for notifying the scheduler about a successful completion of a given stage.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.trino.execution.scheduler.StageExecution
StageExecution.State -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()voidaddStateChangeListener(StateMachine.StateChangeListener<StageExecution.State> stateChangeListener) 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.voidvoidcancel()static PipelinedStageExecutioncreatePipelinedStageExecution(SqlStage stage, Map<PlanFragmentId, io.trino.execution.scheduler.PipelinedOutputBufferManager> outputBufferManagers, TaskLifecycleListener taskLifecycleListener, FailureDetector failureDetector, Executor executor, Optional<int[]> bucketToPartition, int attempt) voidvoidintio.opentelemetry.api.trace.SpangetState()booleanvoidrecordGetSplitTime(long start) scheduleTask(InternalNode node, int partition, com.google.common.collect.Multimap<PlanNodeId, Split> initialSplits) voidvoidschedulingComplete(PlanNodeId partitionedSource) toString()void
-
Method Details
-
createPipelinedStageExecution
public static PipelinedStageExecution createPipelinedStageExecution(SqlStage stage, Map<PlanFragmentId, io.trino.execution.scheduler.PipelinedOutputBufferManager> outputBufferManagers, TaskLifecycleListener taskLifecycleListener, FailureDetector failureDetector, Executor executor, Optional<int[]> bucketToPartition, int attempt) -
getState
- Specified by:
getStatein interfaceStageExecution
-
addStateChangeListener
public void addStateChangeListener(StateMachine.StateChangeListener<StageExecution.State> stateChangeListener) 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.- Specified by:
addStateChangeListenerin interfaceStageExecution
-
beginScheduling
public void beginScheduling()- Specified by:
beginSchedulingin interfaceStageExecution
-
transitionToSchedulingSplits
public void transitionToSchedulingSplits()- Specified by:
transitionToSchedulingSplitsin interfaceStageExecution
-
schedulingComplete
public void schedulingComplete()- Specified by:
schedulingCompletein interfaceStageExecution
-
schedulingComplete
- Specified by:
schedulingCompletein interfaceStageExecution
-
cancel
public void cancel()- Specified by:
cancelin interfaceStageExecution
-
abort
public void abort()- Specified by:
abortin interfaceStageExecution
-
fail
-
failTask
- Specified by:
failTaskin interfaceStageExecution
-
scheduleTask
public Optional<RemoteTask> scheduleTask(InternalNode node, int partition, com.google.common.collect.Multimap<PlanNodeId, Split> initialSplits) - Specified by:
scheduleTaskin interfaceStageExecution
-
getTaskLifecycleListener
- Specified by:
getTaskLifecycleListenerin interfaceStageExecution
-
getAllTasks
- Specified by:
getAllTasksin interfaceStageExecution
-
getTaskStatuses
- Specified by:
getTaskStatusesin interfaceStageExecution
-
isAnyTaskBlocked
public boolean isAnyTaskBlocked()- Specified by:
isAnyTaskBlockedin interfaceStageExecution
-
recordGetSplitTime
public void recordGetSplitTime(long start) - Specified by:
recordGetSplitTimein interfaceStageExecution
-
getStageId
- Specified by:
getStageIdin interfaceStageExecution
-
getAttemptId
public int getAttemptId()- Specified by:
getAttemptIdin interfaceStageExecution
-
getStageSpan
public io.opentelemetry.api.trace.Span getStageSpan()- Specified by:
getStageSpanin interfaceStageExecution
-
getFragment
- Specified by:
getFragmentin interfaceStageExecution
-
getFailureCause
- Specified by:
getFailureCausein interfaceStageExecution
-
toString
-