You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/12/12 09:01:08 UTC
[incubator-kyuubi] branch master updated: [KYUUBI #3953] [IT][Test][K8S] Fix Kyuubi with Spark On Kubernetes Flaky Test
This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new b4e0a9704 [KYUUBI #3953] [IT][Test][K8S] Fix Kyuubi with Spark On Kubernetes Flaky Test
b4e0a9704 is described below
commit b4e0a97044f0648f9c86113a17989e0b4416953f
Author: zwangsheng <22...@qq.com>
AuthorDate: Mon Dec 12 17:00:56 2022 +0800
[KYUUBI #3953] [IT][Test][K8S] Fix Kyuubi with Spark On Kubernetes Flaky Test
### _Why are the changes needed?_
To close #3952 & #3176
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #3953 from zwangsheng/test/fix_spark_on_kubernetes_flaky_test.
Closes #3953
d884f0db [zwangsheng] fix sty;e
9923407c [zwangsheng] using toApplicationState format
e2194010 [zwangsheng] ifx
471745d8 [zwangsheng] Test
Authored-by: zwangsheng <22...@qq.com>
Signed-off-by: Cheng Pan <ch...@apache.org>
---
.../test/spark/SparkOnKubernetesTestsSuite.scala | 3 ++-
.../engine/KubernetesApplicationOperation.scala | 19 +++++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala b/integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala
index 0b011514d..e63c37045 100644
--- a/integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala
+++ b/integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala
@@ -183,6 +183,8 @@ class KyuubiOperationKubernetesClusterClusterModeSuite
s" invalid. must conform https://kubernetes.io/docs/concepts/overview/" +
"working-with-objects/names/#dns-subdomain-names and the value length <= 237")
}
+ // clean test conf
+ conf.unset(KUBERNETES_EXECUTOR_POD_NAME_PREFIX)
}
test("Spark Cluster Mode On Kubernetes Kyuubi KubernetesApplicationOperation Suite") {
@@ -223,6 +225,5 @@ class KyuubiOperationKubernetesClusterClusterModeSuite
val failKillResponse = k8sOperation.killApplicationByTag(sessionHandle.identifier.toString)
assert(!failKillResponse._1)
- assert(failKillResponse._2 === ApplicationOperation.NOT_FOUND)
}
}
diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
index a2d680ab2..81e353b84 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
@@ -23,8 +23,8 @@ import io.fabric8.kubernetes.client.dsl.FilterWatchListDeletable
import org.apache.kyuubi.Logging
import org.apache.kyuubi.config.KyuubiConf
-import org.apache.kyuubi.engine.ApplicationState.{ApplicationState, FAILED, FINISHED, PENDING, RUNNING}
-import org.apache.kyuubi.engine.KubernetesApplicationOperation.SPARK_APP_ID_LABEL
+import org.apache.kyuubi.engine.ApplicationState.{ApplicationState, FAILED, FINISHED, PENDING, RUNNING, UNKNOWN}
+import org.apache.kyuubi.engine.KubernetesApplicationOperation.{toApplicationState, SPARK_APP_ID_LABEL}
import org.apache.kyuubi.util.KubernetesUtils
class KubernetesApplicationOperation extends ApplicationOperation with Logging {
@@ -61,12 +61,19 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
val operation = findDriverPodByTag(tag)
val podList = operation.list().getItems
if (podList.size() != 0) {
- (
- operation.delete(),
- s"Operation of deleted appId: " + s"${podList.get(0).getMetadata.getName} is completed")
+ toApplicationState(podList.get(0).getStatus.getPhase) match {
+ case FAILED | UNKNOWN =>
+ (
+ false,
+ s"Target Pod ${podList.get(0).getMetadata.getName} is in FAILED or UNKNOWN status")
+ case _ =>
+ (
+ operation.delete(),
+ s"Operation of deleted appId: ${podList.get(0).getMetadata.getName} is completed")
+ }
} else {
// client mode
- return jpsOperation.killApplicationByTag(tag)
+ jpsOperation.killApplicationByTag(tag)
}
} catch {
case e: Exception =>