Ngone51 commented on a change in pull request #29468:
URL: https://github.com/apache/spark/pull/29468#discussion_r473641668
##########
File path:
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
##########
@@ -1062,25 +1062,38 @@ private[spark] class TaskSchedulerImpl(
}
def getExecutorsAliveOnHost(host: String): Option[Set[String]] =
synchronized {
- hostToExecutors.get(host).map(_.toSet)
+
hostToExecutors.get(host).map(_.filterNot(isExecutorDecommissioned)).map(_.toSet)
}
def hasExecutorsAliveOnHost(host: String): Boolean = synchronized {
- hostToExecutors.contains(host)
+ hostToExecutors.get(host)
+ .exists(executors => executors.exists(e => !isExecutorDecommissioned(e)))
}
def hasHostAliveOnRack(rack: String): Boolean = synchronized {
- hostsByRack.contains(rack)
+ hostsByRack.get(rack)
+ .exists(hosts => hosts.exists(h => !isHostDecommissioned(h)))
}
def isExecutorAlive(execId: String): Boolean = synchronized {
- executorIdToRunningTaskIds.contains(execId)
+ executorIdToRunningTaskIds.contains(execId) &&
!isExecutorDecommissioned(execId)
}
def isExecutorBusy(execId: String): Boolean = synchronized {
executorIdToRunningTaskIds.get(execId).exists(_.nonEmpty)
}
+ // exposed for test
+ protected def isExecutorDecommissioned(execId: String): Boolean =
+ getExecutorDecommissionInfo(execId).nonEmpty ||
isHostDecommissioned(executorIdToHost(execId))
Review comment:
make sense to me.
----------------------------------------------------------------
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]