Package io.prestosql.execution
Class StageStateMachine
- java.lang.Object
-
- io.prestosql.execution.StageStateMachine
-
@ThreadSafe public class StageStateMachine extends Object
-
-
Constructor Summary
Constructors Constructor Description StageStateMachine(StageId stageId, Session session, PlanFragment fragment, Map<PlanNodeId,TableInfo> tables, ExecutorService executor, SplitSchedulerStats schedulerStats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFinalStageInfoListener(StateMachine.StateChangeListener<StageInfo> finalStatusListener)
Add a listener for the final stage info.void
addStateChangeListener(StateMachine.StateChangeListener<StageState> stateChangeListener)
Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leakingthis
when adding a listener in a constructor.BasicStageStats
getBasicStageStats(Supplier<Iterable<TaskInfo>> taskInfosSupplier)
PlanFragment
getFragment()
Session
getSession()
StageId
getStageId()
StageInfo
getStageInfo(Supplier<Iterable<TaskInfo>> taskInfosSupplier)
StageState
getState()
long
getTotalMemoryReservation()
long
getUserMemoryReservation()
void
recordGetSplitTime(long startNanos)
void
setAllTasksFinal(Iterable<TaskInfo> finalTaskInfos)
String
toString()
boolean
transitionToAborted()
boolean
transitionToCanceled()
boolean
transitionToFailed(Throwable throwable)
boolean
transitionToFinished()
boolean
transitionToFlushing()
boolean
transitionToRunning()
boolean
transitionToScheduled()
boolean
transitionToScheduling()
boolean
transitionToSchedulingSplits()
void
updateMemoryUsage(long deltaUserMemoryInBytes, long deltaRevocableMemoryInBytes, long deltaTotalMemoryInBytes)
-
-
-
Constructor Detail
-
StageStateMachine
public StageStateMachine(StageId stageId, Session session, PlanFragment fragment, Map<PlanNodeId,TableInfo> tables, ExecutorService executor, SplitSchedulerStats schedulerStats)
-
-
Method Detail
-
getStageId
public StageId getStageId()
-
getSession
public Session getSession()
-
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 leakingthis
when 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()
-
transitionToSchedulingSplits
public boolean transitionToSchedulingSplits()
-
transitionToScheduled
public boolean transitionToScheduled()
-
transitionToRunning
public boolean transitionToRunning()
-
transitionToFlushing
public boolean transitionToFlushing()
-
transitionToFinished
public boolean transitionToFinished()
-
transitionToCanceled
public boolean transitionToCanceled()
-
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 leakingthis
when 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)
-
-