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_r331414974
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLAppStatusStore.scala ########## @@ -99,8 +100,58 @@ class SQLExecutionUIData( @JsonIgnore @KVIndex("completionTime") private def completionTimeIndex: Long = completionTime.map(_.getTime).getOrElse(-1L) + + def toLiveExecutionData: LiveExecutionData = { + val liveExecutionData = new LiveExecutionData(executionId) + liveExecutionData.description = description + liveExecutionData.details = details + liveExecutionData.physicalPlanDescription = physicalPlanDescription + liveExecutionData.metrics = metrics + liveExecutionData.submissionTime = submissionTime + liveExecutionData.completionTime = completionTime + liveExecutionData.jobs = jobs + liveExecutionData.stages = stages + liveExecutionData.metricsValues = metricValues + val endNum = jobs.count { case (_, status) => + status == JobExecutionStatus.SUCCEEDED || status == JobExecutionStatus.FAILED } + liveExecutionData.endEvents = endNum + { if (completionTime.isDefined) 1 else 0 } + liveExecutionData + } } +/** + * Used to recover LiveStageMetrics in SQLAppStatusListener. It would be wrote into KVStore Review comment: nit: wrote -> written ---------------------------------------------------------------- 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