packyan commented on code in PR #39021:
URL: https://github.com/apache/spark/pull/39021#discussion_r1045598309


##########
core/src/main/scala/org/apache/spark/SparkContext.scala:
##########
@@ -2136,7 +2138,10 @@ class SparkContext(config: SparkConf) extends Logging {
     }
     if (env != null) {
       Utils.tryLogNonFatalError {
-        env.metricsSystem.report()
+        val metricsReportFuture = Future {
+          env.metricsSystem.report()
+        } (SparkContext.executionContext)
+        ThreadUtils.awaitResult(metricsReportFuture, Duration.create("1s"))

Review Comment:
   I think 1 to 2 seconds is reasonable.  The last metrics report is not 
necessary, we must reserve enough time for the application master hook to 
unregister and clean up temporary files.
   
   What do you think?
   
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to