pan3793 opened a new pull request, #7816:
URL: https://github.com/apache/kyuubi/pull/7816

   ### Why are the changes needed?
   
   A local (JPS) batch that exits with code 0 can be marked ERROR with `job 
failed: Some(ApplicationInfo(null,null,NOT_FOUND,...))`.
   
   In `submitAndMonitorBatchJob`, the submit process is polled every 
`kyuubi.batch.application.check.interval` (default 5s). A short client-mode app 
(e.g. SparkPi on `local`) can start and finish between two polls, so its id is 
never observed and `appStarted` stays false. JPS does not keep the state of 
finished apps, so `NOT_FOUND` here is indistinguishable from "never started", 
and the zero exit code is the only trustworthy signal.
   
   This makes `batch sessions recovery` in 
`BatchesV1ResourceSuite`/`BatchesV2ResourceSuite` flaky, e.g. 
https://github.com/apache/kyuubi/actions/runs/40693174724/job/122832955449
   
   The fix only fails on a missing app id when the app operation persists app 
state (YARN, Kubernetes) or no app operation matches, keeping existing behavior 
for those.
   
   ### How was this patch tested?
   
   Added `local batch finished before the application is detected` to 
`BatchesResourceSuite`, which uses a 1-minute check interval to make the race 
deterministic. It fails without the fix (`"[ERROR]" did not equal 
"[FINISHED]"`) and passes with it.
   
   ```
   build/mvn test -pl kyuubi-server -am -Pspark-3.5 -Dtest=none \
     
-DwildcardSuites=org.apache.kyuubi.server.api.v1.BatchesV1ResourceSuite,org.apache.kyuubi.server.api.v1.BatchesV2ResourceSuite
   ```
   
   ### Was this patch assisted by generative AI tooling?
   
   Assisted-by: Claude Opus 5.5
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to