agrawaldevesh commented on a change in pull request #29014:
URL: https://github.com/apache/spark/pull/29014#discussion_r459766901



##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
##########
@@ -914,12 +916,42 @@ private[spark] class TaskSchedulerImpl(
 
   override def executorDecommission(
       executorId: String, decommissionInfo: ExecutorDecommissionInfo): Unit = {
+    synchronized {
+      // The scheduler can get multiple decommission updates from multiple 
sources,
+      // and some of those can have isHostDecommissioned false. We merge them 
such that
+      // if we heard isHostDecommissioned ever true, then we keep that one 
since it is
+      // most likely coming from the cluster manager and thus authoritative
+      val oldDecomInfo = executorsPendingDecommission.get(executorId)
+      if (oldDecomInfo.isEmpty || !oldDecomInfo.get.isHostDecommissioned) {
+        executorsPendingDecommission(executorId) = decommissionInfo
+      }
+    }
     rootPool.executorDecommission(executorId)
     backend.reviveOffers()
   }
 
-  override def executorLost(executorId: String, reason: ExecutorLossReason): 
Unit = {
+  override def getExecutorDecommissionInfo(executorId: String)
+    : Option[ExecutorDecommissionInfo] = synchronized {
+      executorsPendingDecommission.get(executorId)
+  }
+
+  override def executorLost(executorId: String, givenReason: 
ExecutorLossReason): Unit = {
     var failedExecutor: Option[String] = None
+    val reason = givenReason match {
+      // Handle executor process loss due to decommissioning
+      case ExecutorProcessLost(message, workerLost, _) =>
+        val executorDecommissionInfo = getExecutorDecommissionInfo(executorId)
+        // Executor loss is not caused by app if we knew that this executor is 
being
+        // decommissioned
+        val executorLossCausedByApp = executorDecommissionInfo.isEmpty

Review comment:
       sure. Makes sense.




----------------------------------------------------------------
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:
us...@infra.apache.org



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

Reply via email to