pan3793 commented on code in PR #7033: URL: https://github.com/apache/kyuubi/pull/7033#discussion_r2062504886
########## kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala: ########## @@ -212,6 +215,20 @@ class BatchJobSubmission( metadata match { case Some(metadata) if metadata.peerInstanceClosed => setState(OperationState.CANCELED) + case Some(metadata) + // in case it has been updated by peer kyuubi instance, see KYUUBI-6278 Review Comment: nit: `KYUUBI-6278` => `KYUUBI #6278` does this fix another issue? what happens without this part of the code before/after this PR? ########## kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala: ########## @@ -566,8 +566,9 @@ object KubernetesApplicationOperation extends Logging { case Some(containerAppState) => containerAppState case None => podAppState } - val applicationError = - if (ApplicationState.isFailed(applicationState)) { + val applicationError = { + // here the applicationState could not been NOT_FOUND, safe to use None ApplicationOperation + if (ApplicationState.isFailed(applicationState, appOperation = None)) { Review Comment: what's the issue if we also pass the `appOperation`? ########## kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ApplicationOperation.scala: ########## @@ -91,9 +91,17 @@ object ApplicationState extends Enumeration { type ApplicationState = Value val PENDING, RUNNING, FINISHED, KILLED, FAILED, ZOMBIE, NOT_FOUND, UNKNOWN = Value - def isFailed(state: ApplicationState): Boolean = state match { + def isFailed( + state: ApplicationState, + appOperation: Option[ApplicationOperation]): Boolean = state match { case FAILED => true case KILLED => true + case NOT_FOUND => appOperation match { + // For YARN and Kubernetes operations, if the application is not found, treat it as failed + // to prevent mistakenly set unsuccessful applications to the finished state. + case Some(_: YarnApplicationOperation) | Some(_: KubernetesApplicationOperation) => true Review Comment: Instead of judging the class, how about exposing a method, i.e. `supportPersistedAppState` -- 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: notifications-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org