zwangsheng commented on code in PR #5279:
URL: https://github.com/apache/kyuubi/pull/5279#discussion_r1325261994


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiBatchService.scala:
##########
@@ -83,26 +84,28 @@ class KyuubiBatchService(
               metadata.requestArgs,
               Some(metadata),
               fromRecovery = false)
-            val sessionHandle = sessionManager.openBatchSession(batchSession)
+            sessionManager.openBatchSession(batchSession)
             var submitted = false
             while (!submitted) { // block until batch job submitted
-              submitted = sessionManager.getBatchSession(sessionHandle).map { 
batchSession =>
-                val batchState = 
batchSession.batchJobSubmissionOp.getStatus.state
-                batchState == OperationState.RUNNING || 
OperationState.isTerminal(batchState)
-              }.getOrElse {
-                error(s"Batch Session $batchId is not existed, marked as 
finished")
-                true
+              submitted = metadataManager.getBatchSessionMetadata(batchId) 
match {
+                case Some(metadata) if 
OperationState.isTerminal(metadata.opState) =>
+                  true
+                case Some(metadata) if metadata.opState == 
OperationState.RUNNING =>
+                  metadata.appState match {
+                    // app that is not submitted to resource manager

Review Comment:
   Maybe we can assume when submit operation is running, 
   - app state in PENDING, RUNNING, FINISHED, KILLED, FAILED means been 
submitted(return true)
   - app state in NOT_FOUND or UNKNOWN we should marked as un-submitted and 
wait for out-range fail.



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