Github user GraceH commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7888#discussion_r38828767
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
 ---
    @@ -413,25 +413,38 @@ class CoarseGrainedSchedulerBackend(scheduler: 
TaskSchedulerImpl, val rpcEnv: Rp
        *
        * @param executorIds identifiers of executors to kill
        * @param replace whether to replace the killed executors with new ones
    +   * @param force whether to kill busy executors (who are running tasks)
        * @return whether the kill request is acknowledged.
        */
    -  final def killExecutors(executorIds: Seq[String], replace: Boolean): 
Boolean = synchronized {
    +  final def killExecutors(
    +      executorIds: Seq[String],
    +      replace: Boolean,
    +      force: Boolean): Boolean = synchronized {
         logInfo(s"Requesting to kill executor(s) ${executorIds.mkString(", 
")}")
         val (knownExecutors, unknownExecutors) = 
executorIds.partition(executorDataMap.contains)
         unknownExecutors.foreach { id =>
           logWarning(s"Executor to kill $id does not exist!")
         }
     
    +    val idleExecutors = {
    +      if (force) {
    +        knownExecutors
    +      } else {
    +        knownExecutors.filter(executor =>
    +          !scheduler.taskIdToExecutorId.exists(_._2 == executor))
    +      }
    +    }
         // If we do not wish to replace the executors we kill, sync the target 
number of executors
         // with the cluster manager to avoid allocating new ones. When 
computing the new target,
         // take into account executors that are pending to be added or removed.
         if (!replace) {
           doRequestTotalExecutors(numExistingExecutors + numPendingExecutors
    -        - executorsPendingToRemove.size - knownExecutors.size)
    +        - executorsPendingToRemove.size - idleExecutors.size)
         }
     
    -    executorsPendingToRemove ++= knownExecutors
    -    doKillExecutors(knownExecutors)
    +    executorsPendingToRemove ++= idleExecutors
    +    // return false: there has some busyExecutors or killing certain 
executor failed
    +    doKillExecutors(idleExecutors) && idleExecutors.size == 
knownExecutors.size
    --- End diff --
    
    OK. will do.


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

Reply via email to