srowen 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_r342114405
##########
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:
Nit: this doesn't need to be in the try-catch, and remove the exclamation, I
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.
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]