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

    https://github.com/apache/spark/pull/7888#discussion_r44579436
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
 ---
    @@ -419,17 +420,32 @@ 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 force kill busy executors
        * @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!")
         }
     
    +    // force killing all busy and idle executors
    +    // otherwise, only idle executors are valid to be killed
    +    val idleExecutors =
    +      if (force) {
    +        knownExecutors
    +      } else {
    +        knownExecutors.filter { id =>
    +          logWarning(s"Busy executor $id is not valid to be killed!")
    +          !scheduler.isExecutorBusy(id)}
    +      }
    --- End diff --
    
    I would do
    ```
    // If an executor is already pending to be removed, do not kill it again 
(SPARK-9795)
    // If this executor is busy, do not kill it unless we are told to force 
kill it (SPARK-9552)
    val executorsToKill = knownExecutors
      .filter { id => !executorsPendingToRemove.contains(id) }
      .filter { id => force || !scheduler.isExecutorBusy(id) }
    ```
    no need to log a warning


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to