[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 <2213335496@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
zwangsheng 2023-04-14 16:52:54 +08:00 committed by Cheng Pan
parent 46bddc3864
commit 7b94196ab1
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D
2 changed files with 5 additions and 2 deletions

View File

@ -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 = {

View File

@ -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")
}
}