File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
kyuubi-server/src/main/scala/org/apache/kyuubi/engine Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -498,19 +498,18 @@ object KubernetesApplicationOperation extends Logging {
498
498
}
499
499
500
500
val podAppState = podStateToApplicationState(pod.getStatus.getPhase)
501
- val containerAppState = containerStatusToBuildAppState
501
+ val containerAppStateOpt = containerStatusToBuildAppState
502
502
.map(_.getState)
503
503
.map(containerStateToApplicationState)
504
504
505
- // 1. if the container state is already terminated, use the container state
506
- // 2. if the pod state is terminated, use the pod state and ignore the container state
507
- // 3. otherwise, use the container state if it exists or the pod state
508
- val applicationState = if (containerAppState.exists(ApplicationState .isTerminated)) {
509
- containerAppState.get
510
- } else if (ApplicationState .isTerminated(podAppState)) {
511
- podAppState
512
- } else {
513
- containerAppState.getOrElse(podAppState)
505
+ val applicationState = containerAppStateOpt match {
506
+ // for cases that spark container already terminated, but sidecar containers live
507
+ case Some (containerAppState)
508
+ if ApplicationState .isTerminated(containerAppState) => containerAppState
509
+ // we don't need to care about container state if pod is already terminated
510
+ case _ if ApplicationState .isTerminated(podAppState) => podAppState
511
+ case Some (containerAppState) => containerAppState
512
+ case None => podAppState
514
513
}
515
514
val applicationError =
516
515
if (ApplicationState .isFailed(applicationState)) {
You can’t perform that action at this time.
0 commit comments