Github user piaozhexiu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8216#discussion_r39337138
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/JobWaiter.scala ---
    @@ -69,9 +97,11 @@ private[spark] class JobWaiter[T](
       }
     
       def awaitResult(): JobResult = synchronized {
    +    Try(_originalHandler = attachSigintHandler())
         while (!_jobFinished) {
           this.wait()
         }
    +    Try(detachSigintHandler())
    --- End diff --
    
    @davies thank you for reviewing!
    
    My intention for `Try` was to tolerate any error while detaching signal 
handler since this is on a best effort basis. For eg, if `attachSignalHandler` 
fails for some reason, `detachSignalHanndler` will fail too.
    
    I rewrote this code using `Try`, `Success`, and `Failure` as follows-
    ```
      val attachTry = Try(attachSigintHandler())
      while (!_jobFinished) {
        this.wait()
      }
      attachTry match {
        case _: Success[_] => detachSigintHandler()
        case _: Failure[_] => // Ignore error. Signal handler is on a best 
effort basis.
      }
    ```
    Hopefully it is more clear now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to