HeartSaVioR commented on a change in pull request #25943: 
[WIP][SPARK-29261][SQL][CORE] Support recover live entities from KVStore for 
(SQL)AppStatusListener
URL: https://github.com/apache/spark/pull/25943#discussion_r331410634
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListener.scala
 ##########
 @@ -67,6 +68,27 @@ class SQLAppStatusListener(
     }
   }
 
+  // visible for tests
+  private[spark] def recoverLiveEntities(): Unit = {
+    if (!live) {
+      kvstore.view(classOf[SQLExecutionUIData])
+        // null metricValues potentially indicates a live SQLExecutionUIData
+        .asScala.filter(_.metricValues == null)
+        .map(_.toLiveExecutionData)
+        .foreach(execData => liveExecutions.put(execData.executionId, 
execData))
+      kvstore.view(classOf[SQLStageMetricsWrapper])
+        .asScala.map(_.toLiveStageMetrics)
+        .foreach(metrics => stageMetrics.put(metrics.stageId, metrics))
+    }
+  }
+
+  // used for tests only
+  private[spark] def clearLiveEntities(): Unit = {
+    liveExecutions.clear()
+    stageMetrics.clear()
+  }
+
+
 
 Review comment:
   nit: unnecessary two empty lines - remove one line

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to