presto-main/src/main/java/io/prestosql/execution/StageStateMachine.java/StageStateMachine/transitionToCanceled
class StageStateMachine:    public boolean transitionToCanceled()
    {
        return stageState.setIf(CANCELED, currentState -> !currentState.isDone());
    }