SteNicholas commented on code in PR #3698:
URL: https://github.com/apache/celeborn/pull/3698#discussion_r3308562177
##########
common/src/main/scala/org/apache/celeborn/common/CelebornConf.scala:
##########
@@ -1359,7 +1357,9 @@ class CelebornConf(loadDefaults: Boolean) extends
Cloneable with Logging with Se
// //////////////////////////////////////////////////////
// Graceful Shutdown & Recover //
// //////////////////////////////////////////////////////
- def workerGracefulShutdown: Boolean = get(WORKER_GRACEFUL_SHUTDOWN_ENABLED)
+ def workerDecommissionShutdownEnabled: Boolean =
get(WORKER_DECOMMISSION_SHUTDOWN_ENABLED)
+ def workerGracefulShutdownEnabled: Boolean =
Review Comment:
IMO, decommission shutdown could not affect graceful shutdown behavior.
Therefore, this change could be reverted.
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/Worker.scala:
##########
@@ -1072,29 +1075,42 @@ private[celeborn] class Worker(
workerStatusManager.transitionState(State.Exit)
}
- ShutdownHookManager.get().addShutdownHook(
- ThreadUtils.newThread(
- new Runnable {
- override def run(): Unit = {
- logInfo("Shutdown hook called.")
- workerStatusManager.exitEventType match {
- case WorkerEventType.Graceful =>
- shutdownGracefully()
- case WorkerEventType.Decommission =>
- decommissionWorker()
- case _ =>
- exitImmediately()
- }
+ private val shutdownHookThread = ThreadUtils.newThread(
+ new Runnable {
+ override def run(): Unit = {
+ logInfo("Shutdown hook called.")
+ workerStatusManager.exitEventType match {
+ case WorkerEventType.Graceful =>
+ shutdownGracefully()
+ case WorkerEventType.Decommission =>
+ decommissionWorker()
+ case _ =>
+ exitImmediately()
+ }
- if (workerStatusManager.exitEventType == WorkerEventType.Graceful) {
+ workerStatusManager.exitEventType match {
+ case WorkerEventType.Graceful =>
stop(CelebornExitKind.WORKER_GRACEFUL_SHUTDOWN)
- } else {
+ case WorkerEventType.Decommission =>
+ stop(CelebornExitKind.WORKER_DECOMMISSION)
+ case _ =>
stop(CelebornExitKind.EXIT_IMMEDIATELY)
- }
}
- },
- "worker-shutdown-hook-thread"),
- WORKER_SHUTDOWN_PRIORITY)
+ }
+ },
+ "worker-shutdown-hook-thread")
+
+ if (conf.workerDecommissionShutdownEnabled) {
Review Comment:
Could this add two shutdown hook for decommission shutdown and graceful
shutdown?
--
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]