Gabriel39 commented on a change in pull request #26382:
[SPARK-29738][SPARK-CORE]Add a shutdown hook log wrapper
URL: https://github.com/apache/spark/pull/26382#discussion_r342365197
##########
File path: core/src/main/scala/org/apache/spark/util/Utils.scala
##########
@@ -1967,6 +1967,25 @@ private[spark] object Utils extends Logging {
}
}
+ /**
+ * To figure out which shutdown hook makes execution slow, a logWrapper for
shutdown hook
+ * is used to record execute time for each shutdown hook.
+ *
+ * @param f
+ * @param nextHook
+ * @tparam T
+ */
+ def shutdownHookLogWrapper[T](f: => T, nextHook: SparkShutdownHook): Unit = {
+ val startTime = System.currentTimeMillis()
+ try {
+ logInfo(s"Shutdown hook ${nextHook.caller} starts!")
Review comment:
I think it's possible the function wrapped will throw exception so it's
still necessary to try-catch-finally
----------------------------------------------------------------
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]