SteNicholas commented on code in PR #2075:
URL: 
https://github.com/apache/incubator-celeborn/pull/2075#discussion_r1383259385


##########
common/src/main/scala/org/apache/celeborn/common/CelebornConf.scala:
##########
@@ -2889,6 +2891,15 @@ object CelebornConf extends Logging {
       .timeConf(TimeUnit.MILLISECONDS)
       .createWithDefaultString("10s")
 
+  val APPLICATION_UNREGISTER_ENABLED: ConfigEntry[Boolean] =
+    buildConf("celeborn.client.application.unregister.enabled")
+      .categories("client")
+      .version("0.4.0")

Review Comment:
   ```suggestion
         .version("0.3.2")
   ```



##########
client/src/main/scala/org/apache/celeborn/client/ApplicationHeartbeater.scala:
##########
@@ -96,8 +99,31 @@ class ApplicationHeartbeater(
     }
   }
 
+  private def unregisterApplication(): Unit = {
+    try {
+      // Then unregister Application
+      logInfo(s"Unregister Application when $appId shutdown")
+      masterClient.askSync[ApplicationLostResponse](
+        ApplicationLost(appId),
+        classOf[ApplicationLostResponse])
+    } catch {
+      case e: Exception =>
+        logWarning("AskSync unRegisterApplication failed.", e)
+    }
+  }
+
   def stop(): Unit = {
-    appHeartbeat.cancel(true)
-    ThreadUtils.shutdown(appHeartbeatHandlerThread, 800.millis)
+    stopped.synchronized {
+      if (!stopped) {
+        // Stop appHeartbeat first
+        logInfo(s"Stop Application heartbeat $appId")
+        appHeartbeat.cancel(true)
+        ThreadUtils.shutdown(appHeartbeatHandlerThread, 800.millis)

Review Comment:
   Could this grace period be configurable?



##########
client/src/main/scala/org/apache/celeborn/client/ApplicationHeartbeater.scala:
##########
@@ -36,8 +36,11 @@ class ApplicationHeartbeater(
     shuffleMetrics: () => (Long, Long),
     workerStatusTracker: WorkerStatusTracker) extends Logging {
 
+  private var stopped = false

Review Comment:
   Does this need to use `@volatile`?



##########
client/src/main/scala/org/apache/celeborn/client/ApplicationHeartbeater.scala:
##########
@@ -96,8 +99,31 @@ class ApplicationHeartbeater(
     }
   }
 
+  private def unregisterApplication(): Unit = {
+    try {
+      // Then unregister Application
+      logInfo(s"Unregister Application when $appId shutdown")

Review Comment:
   @RexXiong, could this log add after askSync? Meanwhile, log the status of 
`ApplicationLostResponse`?



-- 
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]

Reply via email to