vanzin commented on a change in pull request #26405: [SPARK-29766][sql] Do
metrics aggregation asynchronously in SQL listener.
URL: https://github.com/apache/spark/pull/26405#discussion_r343216766
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListener.scala
##########
@@ -320,12 +320,18 @@ class SQLAppStatusListener(
private def onExecutionEnd(event: SparkListenerSQLExecutionEnd): Unit = {
val SparkListenerSQLExecutionEnd(executionId, time) = event
Option(liveExecutions.get(executionId)).foreach { exec =>
- exec.metricsValues = aggregateMetrics(exec)
exec.completionTime = Some(new Date(time))
- exec.endEvents += 1
update(exec)
- removeStaleMetricsData(exec)
+ // Aggregating metrics can be expensive for large queries, so do it
asynchronously.
+ // The end event count is also only updated asynchronously, to ensure
that the metrics
+ // are not cleaned up by the update() call above.
+ kvstore.doAsync {
+ exec.endEvents += 1
Review comment:
ah, good point. let me look at that.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]