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

    https://github.com/apache/spark/pull/4168#discussion_r24383247
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
 ---
    @@ -311,18 +303,27 @@ class CoarseGrainedSchedulerBackend(scheduler: 
TaskSchedulerImpl, val actorSyste
     
       /**
        * Request an additional number of executors from the cluster manager.
    -   * Return whether the request is acknowledged.
    +   * @return whether the request is acknowledged.
        */
       final override def requestExecutors(numAdditionalExecutors: Int): 
Boolean = synchronized {
         logInfo(s"Requesting $numAdditionalExecutors additional executor(s) 
from the cluster manager")
         logDebug(s"Number of pending executors is now $numPendingExecutors")
         numPendingExecutors += numAdditionalExecutors
         // Account for executors pending to be added or removed
    -    val newTotal = numExistingExecutors + numPendingExecutors - 
executorsPendingToRemove.size
    +    val newTotal = numExistingExecutors + numPendingExecutors
         doRequestTotalExecutors(newTotal)
       }
     
       /**
    +   * Request an additional number of executors from the cluster manager.
    +   * @return whether the request is acknowledged.
    +   */
    +  final override def requestTotalExecutors(numExecutors: Int): Boolean = 
synchronized {
    +    numPendingExecutors = numExecutors - numExistingExecutors
    --- End diff --
    
    Disallowing `numPendingExecutors` from being negative could lead to some 
strange behavior.
    
    If I call `requestTotalExecutors(5)` and then `requestExecutors(2)`, I 
would expect to eventually end up with 7 executors.  But if I started with 6 
executors, then I would end up with 8.
    
    I don't have a strong opinion either way.  If we allow it to be negative, 
maybe it would make sense to change the name.


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