attilapiros commented on a change in pull request #29014:
URL: https://github.com/apache/spark/pull/29014#discussion_r459766863
##########
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:
Nit: you can use named arguments for constructing the
`ExecutorProcessLost` it has the same power to explain this flag as this
seperate `val`. I would inline the `hostDecommissioned` too as it is kind a
easy to understand especially with the comments above it.
In addition with the named arguments the flags role in the
`ExecutorProcessLost` is described too.
----------------------------------------------------------------
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]