You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/02/08 07:12:41 UTC

[GitHub] [incubator-kyuubi] yaooqinn commented on a change in pull request #1820: [KYUUBI #1816] Implement KyuubiHistoryServerPlugin

yaooqinn commented on a change in pull request #1820:
URL: https://github.com/apache/incubator-kyuubi/pull/1820#discussion_r801323139



##########
File path: externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/spark/ui/EngineTab.scala
##########
@@ -24,25 +24,42 @@ import scala.util.control.NonFatal
 import org.apache.kyuubi.{Logging, Utils}
 import org.apache.kyuubi.config.KyuubiConf
 import org.apache.kyuubi.engine.spark.SparkSQLEngine
+import org.apache.kyuubi.engine.spark.events.EngineEventsStore
 import org.apache.kyuubi.service.ServiceState
 
 /**
  * Note that [[SparkUITab]] is private for Spark
  */
-case class EngineTab(engine: SparkSQLEngine)
-  extends SparkUITab(engine.spark.sparkContext.ui.orNull, "kyuubi") with Logging {
+case class EngineTab(
+    engine: Option[SparkSQLEngine],
+    sparkUI: Option[SparkUI],
+    store: EngineEventsStore,
+    kyuubiConf: KyuubiConf)
+  extends SparkUITab(sparkUI.orNull, "kyuubi") with Logging {
 
   override val name: String = "Kyuubi Query Engine"
-  val killEnabled = engine.getConf.get(KyuubiConf.ENGINE_UI_STOP_ENABLED)
+  val killEnabled = kyuubiConf.get(KyuubiConf.ENGINE_UI_STOP_ENABLED)
 
-  engine.spark.sparkContext.ui.foreach { ui =>
+  val startTime = engine.map(_.getStartTime).getOrElse {
+    sparkUI
+      .map(ui => ui.store.applicationInfo().attempts.head.startTime.getTime)
+      .getOrElse(0L)
+  }
+
+  def endTime(): Long = engine.map(_ => System.currentTimeMillis()).getOrElse {
+    sparkUI
+      .map(ui => ui.store.applicationInfo().attempts.head.endTime.getTime)

Review comment:
       why the start/end Time always use the first attempt?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org