Skip to content

Commit f03d612

Browse files
committed
comments
1 parent b9d6ac2 commit f03d612

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ApplicationOperation.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ trait ApplicationOperation {
8585
tag: String,
8686
proxyUser: Option[String] = None,
8787
submitTime: Option[Long] = None): ApplicationInfo
88+
89+
/**
90+
* Whether the application state can be persisted and retrieved after finished.
91+
* @return true if the application state can be persisted
92+
*/
93+
def supportPersistedAppState: Boolean
8894
}
8995

9096
object ApplicationState extends Enumeration {
@@ -96,12 +102,7 @@ object ApplicationState extends Enumeration {
96102
appOperation: Option[ApplicationOperation]): Boolean = state match {
97103
case FAILED => true
98104
case KILLED => true
99-
case NOT_FOUND => appOperation match {
100-
// For YARN and Kubernetes operations, if the application is not found, treat it as failed
101-
// to prevent mistakenly set unsuccessful applications to the finished state.
102-
case Some(_: YarnApplicationOperation) | Some(_: KubernetesApplicationOperation) => true
103-
case _ => false
104-
}
105+
case NOT_FOUND => appOperation.exists(_.supportPersistedAppState)
105106
case _ => false
106107
}
107108

kyuubi-server/src/main/scala/org/apache/kyuubi/engine/JpsApplicationOperation.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,7 @@ class JpsApplicationOperation extends ApplicationOperation {
105105
// TODO check if the process is zombie
106106
}
107107

108+
override def supportPersistedAppState: Boolean = false
109+
108110
override def stop(): Unit = {}
109111
}

kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
283283
}
284284
}
285285

286+
override def supportPersistedAppState: Boolean = true
287+
286288
override def stop(): Unit = {
287289
enginePodInformers.asScala.foreach { case (_, informer) =>
288290
Utils.tryLogNonFatalError(informer.stop())

kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ class YarnApplicationOperation extends ApplicationOperation with Logging {
165165
}
166166
}
167167

168+
override def supportPersistedAppState: Boolean = true
169+
168170
override def stop(): Unit = adminYarnClient.foreach { yarnClient =>
169171
Utils.tryLogNonFatalError(yarnClient.stop())
170172
}

kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class BatchJobSubmission(
216216
case Some(metadata) if metadata.peerInstanceClosed =>
217217
setState(OperationState.CANCELED)
218218
case Some(metadata)
219-
// in case it has been updated by peer kyuubi instance, see KYUUBI-6278
219+
// in case it has been updated by peer kyuubi instance, see KYUUBI #6278
220220
if StringUtils.isNotBlank(metadata.engineState) &&
221221
ApplicationState.isTerminated(ApplicationState.withName(metadata.engineState)) =>
222222
_applicationInfo = Some(new ApplicationInfo(

0 commit comments

Comments
 (0)