Package io.trino.execution
Class StageStateMachine
- java.lang.Object
-
- io.trino.execution.StageStateMachine
-
@ThreadSafe public class StageStateMachine extends Object
-
-
Constructor Summary
Constructors Constructor Description StageStateMachine(StageId stageId, PlanFragment fragment, Map<PlanNodeId,TableInfo> tables, Executor executor, SplitSchedulerStats schedulerStats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFinalStageInfoListener(StateMachine.StateChangeListener<StageInfo> finalStatusListener)Add a listener for the final stage info.voidaddStateChangeListener(StateMachine.StateChangeListener<StageState> 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.BasicStageStatsgetBasicStageStats(Supplier<Iterable<TaskInfo>> taskInfosSupplier)PlanFragmentgetFragment()StageIdgetStageId()StageInfogetStageInfo(Supplier<Iterable<TaskInfo>> taskInfosSupplier)StageStategetState()longgetTotalMemoryReservation()longgetUserMemoryReservation()voidrecordGetSplitTime(long startNanos)voidsetAllTasksFinal(Iterable<TaskInfo> finalTaskInfos)StringtoString()booleantransitionToAborted()booleantransitionToFailed(Throwable throwable)booleantransitionToFinished()booleantransitionToPending()booleantransitionToRunning()booleantransitionToScheduling()voidupdateMemoryUsage(long deltaUserMemoryInBytes, long deltaRevocableMemoryInBytes, long deltaTotalMemoryInBytes)
-
-
-
Constructor Detail
-
StageStateMachine
public StageStateMachine(StageId stageId, PlanFragment fragment, Map<PlanNodeId,TableInfo> tables, Executor executor, SplitSchedulerStats schedulerStats)
-
-
Method Detail
-
getStageId
public StageId getStageId()
-
getState
public StageState getState()
-
getFragment
public PlanFragment getFragment()
-
addStateChangeListener
public void addStateChangeListener(StateMachine.StateChangeListener<StageState> 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. Additionally, it is possible notifications are observed out of order due to the asynchronous execution.
-
transitionToScheduling
public boolean transitionToScheduling()
-
transitionToRunning
public boolean transitionToRunning()
-
transitionToPending
public boolean transitionToPending()
-
transitionToFinished
public boolean transitionToFinished()
-
transitionToAborted
public boolean transitionToAborted()
-
transitionToFailed
public boolean transitionToFailed(Throwable throwable)
-
addFinalStageInfoListener
public void addFinalStageInfoListener(StateMachine.StateChangeListener<StageInfo> finalStatusListener)
Add a listener for the final stage info. This notification is guaranteed to be fired only once. 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.
-
getUserMemoryReservation
public long getUserMemoryReservation()
-
getTotalMemoryReservation
public long getTotalMemoryReservation()
-
updateMemoryUsage
public void updateMemoryUsage(long deltaUserMemoryInBytes, long deltaRevocableMemoryInBytes, long deltaTotalMemoryInBytes)
-
getBasicStageStats
public BasicStageStats getBasicStageStats(Supplier<Iterable<TaskInfo>> taskInfosSupplier)
-
recordGetSplitTime
public void recordGetSplitTime(long startNanos)
-
-