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 2023/04/14 08:53:04 UTC

[kyuubi] branch master updated: [KYUUBI #4681][Engine] Set thread `CreateSparkTimeoutChecker` daemon

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/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b94196ab [KYUUBI #4681][Engine] Set thread `CreateSparkTimeoutChecker` daemon
7b94196ab is described below

commit 7b94196ab1fb5d5cb636b20cd76f08dd41b2b2dc
Author: zwangsheng <22...@qq.com>
AuthorDate: Fri Apr 14 16:52:54 2023 +0800

    [KYUUBI #4681][Engine] Set thread `CreateSparkTimeoutChecker` daemon
    
    ### _Why are the changes needed?_
    
    Close #4681
    
    Set `CreateSparkTimeoutChecker` in `SparkSQLEngine` daemon.
    
    Exit when spark session initialize fail.
    
    ### _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.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4682 from zwangsheng/KYUUBI_4681.
    
    Closes #4681
    
    1928a67ec [zwangsheng] Add thread name
    57f1914e4 [zwangsheng] Add thread name
    71ff31a2b [zwangsheng] revert
    4e8a619b2 [zwangsheng] DEBUG
    ea23fae11 [zwangsheng] Change Init Timeout => 10M
    3a89acc64 [zwangsheng] fix comments
    565d1c90a [zwangsheng] [KYUUBI #4681][Engine] Set thread  daemon
    
    Authored-by: zwangsheng <22...@qq.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala  | 6 ++++--
 .../kyuubi/kubernetes/test/spark/SparkOnKubernetesTestsSuite.scala  | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
index 42e7c44a1..6f8aa2ec0 100644
--- a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
+++ b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
@@ -359,7 +359,7 @@ object SparkSQLEngine extends Logging {
 
   private def startInitTimeoutChecker(startTime: Long, timeout: Long): Unit = {
     val mainThread = Thread.currentThread()
-    new Thread(
+    val checker = new Thread(
       () => {
         while (System.currentTimeMillis() - startTime < timeout && !sparkSessionCreated.get()) {
           Thread.sleep(500)
@@ -368,7 +368,9 @@ object SparkSQLEngine extends Logging {
           mainThread.interrupt()
         }
       },
-      "CreateSparkTimeoutChecker").start()
+      "CreateSparkTimeoutChecker")
+    checker.setDaemon(true)
+    checker.start()
   }
 
   private def isOnK8sClusterMode: Boolean = {
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 5141ff4d7..74090bc40 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
@@ -57,6 +57,7 @@ abstract class SparkOnKubernetesSuiteBase
       .set("spark.kubernetes.executor.request.cores", "250m")
       .set("kyuubi.kubernetes.context", "minikube")
       .set("kyuubi.frontend.protocols", "THRIFT_BINARY,REST")
+      .set("kyuubi.session.engine.initialize.timeout", "PT10M")
   }
 }