in spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppReconciler.java [150:186]
protected List<AppReconcileStep> getReconcileSteps(final SparkApplication app) {
List<AppReconcileStep> steps = new ArrayList<>();
steps.add(new AppValidateStep());
steps.add(new AppTerminatedStep());
switch (app.getStatus().getCurrentState().getCurrentStateSummary()) {
case Submitted, ScheduledToRestart -> steps.add(new AppInitStep());
case DriverRequested, DriverStarted -> {
steps.add(
new AppResourceObserveStep(
List.of(new AppDriverStartObserver(), new AppDriverReadyObserver())));
steps.add(
new AppResourceObserveStep(Collections.singletonList(new AppDriverRunningObserver())));
steps.add(
new AppResourceObserveStep(Collections.singletonList(new AppDriverTimeoutObserver())));
}
case DriverReady,
InitializedBelowThresholdExecutors,
RunningHealthy,
RunningWithBelowThresholdExecutors -> {
steps.add(new AppRunningStep());
steps.add(
new AppResourceObserveStep(Collections.singletonList(new AppDriverRunningObserver())));
steps.add(
new AppResourceObserveStep(Collections.singletonList(new AppDriverTimeoutObserver())));
}
case DriverReadyTimedOut,
DriverStartTimedOut,
ExecutorsStartTimedOut,
Succeeded,
DriverEvicted,
Failed,
SchedulingFailure ->
steps.add(new AppCleanUpStep());
default -> steps.add(new AppUnknownStateStep());
}
return steps;
}