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



##########
File path: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
##########
@@ -1767,8 +1767,17 @@ private[spark] class DAGScheduler(
 
           // TODO: mark the executor as failed only if there were lots of 
fetch failures on it
           if (bmAddress != null) {
-            val hostToUnregisterOutputs = if 
(env.blockManager.externalShuffleServiceEnabled &&
-              unRegisterOutputOnHostOnFetchFailure) {
+            val externalShuffleServiceEnabled = 
env.blockManager.externalShuffleServiceEnabled
+            val executorDecommissionedWithShuffleLost = taskScheduler
+                .getExecutorDecommissionInfo(bmAddress.executorId)
+                .map(_.isShuffleLost(externalShuffleServiceEnabled))
+                .getOrElse(false)
+            // If we already know that this executor was decommissioned and 
the config is set

Review comment:
       `the config is set`? No config now?

##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
##########
@@ -911,13 +913,33 @@ private[spark] class TaskSchedulerImpl(
     }
   }
 
-  override def executorDecommission(executorId: String): Unit = {
+  override def executorDecommission(executorId: String,
+                                    decommissionInfo: DecommissionInfo): Unit 
= {
+    synchronized {
+      if (!executorsPendingDecommission.contains(executorId)) {
+        executorsPendingDecommission(executorId) = decommissionInfo
+      }
+    }
     rootPool.executorDecommission(executorId)
     backend.reviveOffers()
   }
 
-  override def executorLost(executorId: String, reason: ExecutorLossReason): 
Unit = {
+  override def getExecutorDecommissionInfo(executorId: String): 
Option[DecommissionInfo] =
+    synchronized {
+   executorsPendingDecommission.get(executorId)
+  }
+
+  override def executorLost(executorId: String, givenReason: 
ExecutorLossReason): Unit = {
     var failedExecutor: Option[String] = None
+    val executorLostWithShuffleLost = 
getExecutorDecommissionInfo(executorId).map(
+      _.isShuffleLost(sc.env.blockManager.externalShuffleServiceEnabled))

Review comment:
       nit:
   ```suggestion
       val executorLostWithShuffleLost = getExecutorDecommissionInfo(executorId)
         
.exists(_.isShuffleLost(sc.env.blockManager.externalShuffleServiceEnabled))
   ```
   
   Then, we don't need `if executorLostWithShuffleLost.isDefined`.

##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/ExecutorLossReason.scala
##########
@@ -54,10 +54,13 @@ private [spark] object LossReasonPending extends 
ExecutorLossReason("Pending los
 /**
  * @param _message human readable loss reason
  * @param workerLost whether the worker is confirmed lost too (i.e. including 
shuffle service)
+ *                   Used to know whether the shuffle data is lost too.
+ * @param causedByApp whether the loss of the slave is the fault of the 
running app. (assumed true
+ *                    by default unless known explicitly otherwise)
  */
 private[spark]
-case class SlaveLost(_message: String = "Slave lost", workerLost: Boolean = 
false)
-  extends ExecutorLossReason(_message)
+case class SlaveLost(_message: String = "Slave lost", workerLost: Boolean = 
false,
+                     causedByApp: Boolean = true) extends 
ExecutorLossReason(_message)

Review comment:
       BTW, `causedByApp` is not used at all?

##########
File path: core/src/main/scala/org/apache/spark/scheduler/DecommissionInfo.scala
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.scheduler
+
+/**
+ * Provides more detail about a decommissioning event
+ * @param message human readable reason for why the decommissioning is 
happening
+ * @param isWorkerDecommissioned whether the worker is being decommissioned 
too.
+ *                                 Used to know if the shuffle data might be 
lost too.

Review comment:
       nit: `Used` should be aligned to `whether`.

##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
##########
@@ -911,13 +913,33 @@ private[spark] class TaskSchedulerImpl(
     }
   }
 
-  override def executorDecommission(executorId: String): Unit = {
+  override def executorDecommission(executorId: String,
+                                    decommissionInfo: DecommissionInfo): Unit 
= {
+    synchronized {
+      if (!executorsPendingDecommission.contains(executorId)) {
+        executorsPendingDecommission(executorId) = decommissionInfo
+      }
+    }
     rootPool.executorDecommission(executorId)
     backend.reviveOffers()
   }
 
-  override def executorLost(executorId: String, reason: ExecutorLossReason): 
Unit = {
+  override def getExecutorDecommissionInfo(executorId: String): 
Option[DecommissionInfo] =
+    synchronized {
+   executorsPendingDecommission.get(executorId)
+  }
+
+  override def executorLost(executorId: String, givenReason: 
ExecutorLossReason): Unit = {
     var failedExecutor: Option[String] = None
+    val executorLostWithShuffleLost = 
getExecutorDecommissionInfo(executorId).map(
+      _.isShuffleLost(sc.env.blockManager.externalShuffleServiceEnabled))
+    val reason = givenReason match {
+      // If the node was previously decom'd and then lost: (a) Mark its loss 
as expected

Review comment:
       `node` or `executor`?

##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
##########
@@ -911,13 +913,33 @@ private[spark] class TaskSchedulerImpl(
     }
   }
 
-  override def executorDecommission(executorId: String): Unit = {
+  override def executorDecommission(executorId: String,
+                                    decommissionInfo: DecommissionInfo): Unit 
= {
+    synchronized {
+      if (!executorsPendingDecommission.contains(executorId)) {
+        executorsPendingDecommission(executorId) = decommissionInfo
+      }
+    }
     rootPool.executorDecommission(executorId)
     backend.reviveOffers()
   }
 
-  override def executorLost(executorId: String, reason: ExecutorLossReason): 
Unit = {
+  override def getExecutorDecommissionInfo(executorId: String): 
Option[DecommissionInfo] =
+    synchronized {
+   executorsPendingDecommission.get(executorId)

Review comment:
       nit:
   ```suggestion
     override def getExecutorDecommissionInfo(executorId: String)
       : Option[DecommissionInfo] = synchronized {
         executorsPendingDecommission.get(executorId)
   ```

##########
File path: 
core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala
##########
@@ -259,12 +260,13 @@ private[spark] class CoarseGrainedExecutorBackend(
   }
 
   private def decommissionSelf(): Boolean = {
-    logInfo("Decommissioning self w/sync")
+    val msg = "Decommissioning self w/sync"

Review comment:
       I know it's from original commit, but shall we use `with` instead of 
`w/`? Log info is exposed to end-users. I'm afraid some of them may not 
understand it.




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



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

Reply via email to