Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/6310#discussion_r30844422
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
---
@@ -369,24 +369,47 @@ class CoarseGrainedSchedulerBackend(scheduler:
TaskSchedulerImpl, val rpcEnv: Rp
* Request that the cluster manager kill the specified executors.
* Return whether the kill request is acknowledged.
*/
- final override def killExecutors(executorIds: Seq[String]): Boolean =
synchronized {
- logInfo(s"Requesting to kill executor(s) ${executorIds.mkString(",
")}")
- val filteredExecutorIds = new ArrayBuffer[String]
- executorIds.foreach { id =>
- if (executorDataMap.contains(id)) {
- filteredExecutorIds += id
+ final override def killExecutors(executorIds: Seq[String]): Boolean = {
+ val executorIdsToKill = new ArrayBuffer[String]
+
+ // New target total after all pending requests have been granted
+ val newTargetTotal = synchronized {
+ if (executorIds.size == 1) {
+ logInfo(s"Requesting cluster manager to kill executor
${executorIds.head}.")
+ } else if (executorIds.size > 1) {
+ logInfo(s"Requesting cluster manager to kill executors
${executorIds.mkString(", ")}")
} else {
- logWarning(s"Executor to kill $id does not exist!")
+ // No executors to kill
+ return false
+ }
+
+ executorIds.foreach { id =>
+ if (executorDataMap.contains(id)) {
+ executorIdsToKill += id
+ } else {
+ logWarning(s"Executor to kill $id does not exist!")
+ }
+ }
+
+ executorsPendingToRemove ++= executorIdsToKill
+
+ numExistingExecutors + numPendingExecutors -
executorsPendingToRemove.size
--- End diff --
@vanzin I believe this is functionally equivalent to what you had in the
old code (L384). I believe the only difference is that I moved the
`askWithReply` out of the synchronized block. Please let me me know if this is
not the case.
```
val newTotal = (numExistingExecutors + numPendingExecutors -
executorsPendingToRemove.size
- filteredExecutorIds.size)
...
executorsPendingToRemove ++= filteredExecutorIds
```
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]