[KYUUBI #766] Use default zone id for start time

<!--
Thanks for sending a pull request!

Here are some tips for you:
  1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
  2. If the PR is related to an issue in https://github.com/NetEase/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->

### _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.
-->
Provide a more readable time for user.

### _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

- [x] [Run test](https://kyuubi.readthedocs.io/en/latest/tools/testing.html#running-tests) locally before make a pull request

Closes #766 from ulysses-you/zoneid.

Closes #766

55a4c4c1 [ulysses-you] zone id

Authored-by: ulysses-you <ulyssesyou18@gmail.com>
Signed-off-by: ulysses-you <ulyssesyou18@gmail.com>
(cherry picked from commit 69d4197151)
Signed-off-by: ulysses-you <ulyssesyou18@gmail.com>
This commit is contained in:
ulysses-you 2021-07-09 12:54:07 +08:00
parent c521e6fc6a
commit eb27abc9f2

View File

@ -17,7 +17,7 @@
package org.apache.kyuubi.engine.spark
import java.time.Instant
import java.time.{Instant, LocalDateTime, ZoneId}
import org.apache.spark.sql.SparkSession
@ -29,6 +29,7 @@ object KyuubiSparkUtil {
val webUrl = sc.getConf.getOption(
"spark.org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpFilter.param.PROXY_URI_BASES")
.orElse(sc.uiWebUrl).getOrElse("")
// scalastyle:off line.size.limit
s"""
| Spark application name: ${sc.appName}
| application ID: ${sc.applicationId}
@ -36,7 +37,8 @@ object KyuubiSparkUtil {
| master: ${sc.master}
| deploy mode: ${sc.deployMode}
| version: ${sc.version}
| Start time: ${Instant.ofEpochMilli(sc.startTime)}
| Start time: ${LocalDateTime.ofInstant(Instant.ofEpochMilli(sc.startTime), ZoneId.systemDefault)}
| User: ${sc.sparkUser}""".stripMargin
// scalastyle:on line.size.limit
}
}