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

    https://github.com/apache/spark/pull/15013#discussion_r78092817
  
    --- Diff: 
core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala
 ---
    @@ -148,12 +149,32 @@ private[spark] class CoarseGrainedExecutorBackend(
        * executor exits differently. For e.g. when an executor goes down,
        * back-end may not want to take the parent process down.
        */
    -  protected def exitExecutor(code: Int, reason: String, throwable: 
Throwable = null) = {
    +  protected def exitExecutor(code: Int,
    +                             reason: String,
    +                             throwable: Throwable = null,
    +                             notifyDriver: Boolean = true) = {
    +    val message = "Executor self-exiting due to : " + reason
         if (throwable != null) {
    -      logError(reason, throwable)
    +      logError(message, throwable)
         } else {
    -      logError(reason)
    +      logError(message)
         }
    +
    +    if (notifyDriver) {
    +      logInfo(s"Notifying the driver before exiting the executor")
    +      rpcEnv.asyncSetupEndpointRefByURI(driverUrl).flatMap { ref =>
    --- End diff --
    
    not need to connect to driver if `driver` is None. It's usually because we 
cannot connect to driver.
    ```scala
    if (notifyDriver && driver.nonEmpty) {
      driver.get.ask[Boolean](RemoveExecutor(executorId, new 
ExecutorLossReason(reason))).onFailure { case e =>
          logWarning(s"Unable to notify the driver due to " + e.getMessage, e)
        }(ThreadUtils.sameThread)
    }
    ```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to