srowen commented on a change in pull request #27832: [SPARK-31011][CORE][K8S] 
Log better message if SIGPWR is not supported while setting up decommision
URL: https://github.com/apache/spark/pull/27832#discussion_r390301639
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/util/SignalUtils.scala
 ##########
 @@ -58,18 +58,45 @@ private[spark] object SignalUtils extends Logging {
    */
   def register(signal: String)(action: => Boolean): Unit = synchronized {
     if (SystemUtils.IS_OS_UNIX) {
-      try {
-        val handler = handlers.getOrElseUpdate(signal, {
-          logInfo("Registering signal handler for " + signal)
-          new ActionHandler(new Signal(signal))
-        })
-        handler.register(action)
-      } catch {
-        case ex: Exception => logWarning(s"Failed to register signal handler 
for " + signal, ex)
-      }
+      register(signal, s"Failed to register signal handler for " + signal,
+        logStackTrace = true)(action)
     }
   }
 
+  /**
+   * Adds an action to be run when a given signal is received by this process.
+   *
+   * This method receives failMessage as additional parameter, which would be 
logged when it fails
+   * to register the signal. Here the failures include the cases 1) OS doesn't 
support signal at
+   * all 2) OS doesn't support given signal (Could be possible with non-POSIX 
signals)
+   *
+   * All actions for a given signal are run in a separate thread.
+   */
+  def register(
+      signal: String,
+      failMessage: => String,
 
 Review comment:
   I suppose this can just be `String` rather than delay evaluation, but it 
doesn't matter much.

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

Reply via email to