velo opened a new pull request, #1274:
URL: https://github.com/apache/flink-kubernetes-operator/pull/1274

   ## What is the purpose of the change
   
   A FlinkDeployment running a BATCH job reports `jobStatus.state: CREATED` for 
the whole run and goes straight to `FINISHED`, while the JobManager reports the 
job as `RUNNING`. Anything that waits for `RUNNING` treats a healthy batch job 
as not started (FLINK-41820).
   
   **Root cause** (correcting the JIRA description, which credits FLINK-34906): 
the `RUNNING` to `CREATED` downgrade comes from FLINK-27868 ("Harden running 
job check"), which reports a job as `RUNNING` only once all of its tasks are 
`RUNNING` or `FINISHED`. FLINK-34906 later moved that logic into 
`JobStatusUtils` so the standalone autoscaler could share it. For streaming 
jobs this is right, since all tasks are scheduled at once. In BATCH mode, later 
stages stay `CREATED` until their inputs finish, so the condition only holds at 
the very end of the run.
   
   This change keeps the FLINK-27868 check for streaming jobs and reports 
Flink's own status for BATCH jobs.
   
   ## Brief change log
   
     - `JobStatusUtils#toJobStatusMessage(JobDetails, RuntimeExecutionMode)` 
skips the "all tasks running" adjustment for `RuntimeExecutionMode.BATCH`; the 
existing single-argument overload keeps the current behavior, so the standalone 
autoscaler is unchanged.
     - `AbstractFlinkService#getJobStatus` passes the deployment's 
`execution.runtime-mode`.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - `JobStatusUtilsTest#batchJobWithPendingStagesIsRunning`: a RUNNING job 
with FINISHED, RUNNING and CREATED tasks is reported `RUNNING` in BATCH mode 
and still `CREATED` in STREAMING mode.
     - `AbstractFlinkServiceTest#batchJobWithPendingStagesIsRunningTest`: the 
same through `getJobStatus` against a stubbed `/jobs/overview`. It fails 
without the change (`expected: RUNNING but was: CREATED`).
     - Observed on Flink 2.3.0 with operator 1.16.1: the Web UI showed the job 
`RUNNING` (16 of 18 tasks FINISHED, 1 RUNNING, 1 CREATED) while `kubectl get 
flinkdeployment` showed `CREATED`/`DEPLOYED`.
   
   A BATCH job whose runtime mode is set only inside the job (and not in 
`flinkConfiguration`) still gets the streaming behavior.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changes to the `CustomResourceDescriptors`: 
no
     - Core observer or reconciler logic that is regularly executed: yes (job 
status observation)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to