Repository navigation
Commit 9f7af65
committed
[SPARK-59635] Requeue immediately when
### What changes were proposed in this pull request?
This PR aims to make `AppRunningStep` requeue immediately (`completeAndImmediateRequeue()`) instead of using the default interval (`completeAndDefaultRequeue()`) when it appends a new running state (e.g. `DriverReady -> RunningHealthy`).
The next reconcile then takes the `proposedStateSummary == prevStateSummary` branch and observes the driver with `AppDriverRunningObserver`. This is the same way `AppReconcileStep.observeDriver` already works when it changes the state.
### Why are the changes needed?
When `AppRunningStep` changes the state, it completes the reconcile loop, so the same reconcile doesn't observe driver termination. The following `AppResourceObserveStep(AppDriverRunningObserver)` doesn't run either. If no more pod events arrive, the termination is only detected by the periodic reconcile (`spark.kubernetes.operator.reconciler.intervalSeconds`).
This happens easily with the per-resource reconcile rate limiter (`refreshPeriodSeconds=15`, `maxLoopForPeriod=5` by default). A short job's driver and executor pod events are postponed to the end of the rate-limit period. The postponed reconcile then sees `DriverReady` while the driver pod has already succeeded. For example, `tests/e2e/state-transition` failed locally because `Succeeded` was recorded 120 seconds after `RunningHealthy`, which is longer than the 60s assert timeout:
```
14:17:50.09 Submitted
14:17:50.39 DriverRequested
14:17:50.86 DriverStarted / DriverReady
14:18:05.09 RunningHealthy
14:20:05.11 Succeeded
```
With this PR, `Succeeded` is recorded right after `RunningHealthy`:
```
14:38:14.650 RunningHealthy
14:38:14.660 Succeeded
14:38:14.762 ResourceReleased
```
The cost is one extra reconcile for each running state transition.
### Does this PR introduce _any_ user-facing change?
Yes. The operator now detects driver termination right after it reports a running state, instead of waiting for the next periodic reconcile.
### How was this patch tested?
Pass the CIs with the newly added test case in `AppRunningStepTest`.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5
Closes #845 from dongjoon-hyun/SPARK-59635.
Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>AppRunningStep changes the running state1 parent f264275 commit 9f7af65
2 files changed
Lines changed: 21 additions & 2 deletions
File tree
- spark-operator/src
- main/java/org/apache/spark/k8s/operator/reconciler/reconcilesteps
- test/java/org/apache/spark/k8s/operator/reconciler/reconcilesteps
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
167 | 186 | | |
168 | 187 | | |
169 | 188 | | |
| |||
0 commit comments