[KYUUBI #1067] Catch exception if logRoot is not exist

BUGFIX:
#1067
This PR is just for version_1.3.0

### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
  1. If you add a feature, you can talk about the use case of it.
  2. If you fix a bug, you can clarify why it is a bug.
-->

### _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/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #1154 from zhang1002/branh-1.3_catch-exception.

Closes #1067

2d9aaa5c [张宇翔] catch exception if logRoot is not exist

Authored-by: 张宇翔 <zhang1002@126.com>
Signed-off-by: ulysses-you <ulyssesyou@apache.org>
This commit is contained in:
张宇翔 2021-09-28 13:29:58 +08:00 committed by ulysses-you
parent d621e50e58
commit 1d2f172db4
No known key found for this signature in database
GPG Key ID: 4C500BC62D576766
2 changed files with 13 additions and 4 deletions

View File

@ -65,8 +65,10 @@ case class SparkSQLEngine(spark: SparkSession) extends Serverable("SparkSQLEngin
}
override def stop(): Unit = {
eventLogging.onEvent(
engineStatus.copy(state = ServiceState.STOPPED.id, endTime = System.currentTimeMillis()))
if (!state.equals(ServiceState.LATENT)) {
eventLogging.onEvent(
engineStatus.copy(state = ServiceState.STOPPED.id, endTime = System.currentTimeMillis()))
}
super.stop()
}
@ -150,7 +152,9 @@ object SparkSQLEngine extends Logging {
currentEngine.foreach { engine =>
val status =
engine.engineStatus.copy(diagnostic = s"Error State SparkSQL Engine ${t.getMessage}")
EventLoggingService.onEvent(status)
if (!engine.getServiceState.equals(ServiceState.LATENT)) {
EventLoggingService.onEvent(status)
}
error(status, t)
engine.stop()
}

View File

@ -98,13 +98,18 @@ object EngineEvent {
val webUrl = sc.getConf.getOption(
"spark.org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpFilter.param.PROXY_URI_BASES")
.orElse(sc.uiWebUrl).getOrElse("")
val connectionUrl = if (engine.getServiceState.equals(ServiceState.LATENT)) {
null
} else {
engine.connectionUrl
}
new EngineEvent(
sc.applicationId,
sc.applicationAttemptId,
sc.appName,
sc.sparkUser,
engine.getConf.get(ENGINE_SHARE_LEVEL),
engine.connectionUrl,
connectionUrl,
sc.master,
sc.version,
webUrl,