presto-main/src/main/java/io/prestosql/execution/StageStateMachine.java/StageStateMachine/transitionToScheduled
class StageStateMachine:    public synchronized boolean transitionToScheduled()
    {
        schedulingComplete.compareAndSet(null, DateTime.now());
        return stageState.setIf(SCHEDULED, currentState -> currentState == PLANNED || currentState == SCHEDULING || currentState == SCHEDULING_SPLITS);
    }