… Yarn applications
FlinkAppHttpWatcher#getStateFromYarn reads yarnAppInfo.getApp().getFinalStatus().
On a running Yarn application finalStatus is always UNDEFINED, so the state
maps to FlinkAppStateEnum.OTHER and the status update is skipped: the console
shows the application jumping from STARTING straight to a terminal state,
and the intermediate states are never displayed (issue apache#4356).
Read app.getState() instead, which carries the live Yarn state (RUNNING,
FINISHED, FAILED, KILLED) and maps correctly while the application is
still running.
The doPersistMetrics call in this path must also pass stopWatch=false:
with the fix, intermediate states now reach this call, and the previous
stopWatch=true would unwatch the application while it is still running,
freezing further status updates. doPersistMetrics keeps unwatching terminal
states on its own through the isEndState branch.
Also add debug logs for the tracked appId and the REST URLs used by the
watcher (no full response logging).
What changes were proposed in this pull request
Issue Number: relates to #4356
FlinkAppHttpWatcher#getStateFromYarnreadsyarnAppInfo.getApp().getFinalStatus(). On a running Yarn applicationfinalStatusis alwaysUNDEFINED(it only takes a value such as SUCCEEDED/FAILED/KILLED once the application has terminated), so the state maps toFlinkAppStateEnum.OTHERand the status update is skipped. The console therefore shows an application jumping from STARTING straight to a terminal state — the intermediate states are never displayed.This PR reads
app.getState()instead, which carries the live Yarn state (RUNNING, FINISHED, FAILED, KILLED) and maps correctly while the application is still running.The
doPersistMetricscall in this path must also passstopWatch=false— a companion change required by the first fix:stopWatch=truewas harmless.stopWatch=truewould unwatch the application while it is still running, freezing further status updates.doPersistMetricskeeps unwatching terminal states on its own through theisEndStatebranch, so terminal-state handling is unaffected.Note: #4356 was closed as completed, but both
getFinalStatus()call sites are still present on currentdev, and the UNDEFINED → OTHER skip mechanism still reproduces, so the fix is still needed.Brief change log
getStateFromYarn: readyarnAppInfo.getApp().getState()instead ofgetFinalStatus()(2 call sites).getStateFromYarn: passstopWatch=falsetodoPersistMetricsin the running-state update path.Verifying this change
This change is a bug fix in a watcher that requires a live Yarn/Flink REST endpoint, so it has no dedicated unit test. It can be verified as follows:
Does this pull request potentially affect one of the following parts