Github user cloud-fan commented on a diff in the pull request:
    --- Diff: 
core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala ---
    @@ -572,20 +572,35 @@ private[spark] class ExecutorAllocationManager(
    +   * Callback invoked when an extra executor is needed (See SPARK-19326)
    +   */
    +  private def onExtraExecutorNeeded(): Unit = synchronized {
    +    val maxNeeded = math.max(math.min(maxNumExecutorsNeeded + 1, 
maxNumExecutors), minNumExecutors)
    +    val addRequestAcknowledged = testing ||
    +      client.requestTotalExecutors(maxNeeded, localityAwareTasks, 
    +    if (addRequestAcknowledged) {
    +      logInfo(s"Requesting one new executor because speculative tasks are 
    +    }
    +  }
    +  /**
        * A listener that notifies the given allocation manager of when to add 
and remove executors.
        * This class is intentionally conservative in its assumptions about the 
relative ordering
    -   * and consistency of events returned by the listener. For simplicity, 
it does not account
    -   * for speculated tasks.
    +   * and consistency of events returned by the listener.
       private class ExecutorAllocationListener extends SparkListener {
         private val stageIdToNumTasks = new mutable.HashMap[Int, Int]
         private val stageIdToTaskIndices = new mutable.HashMap[Int, 
         private val executorIdToTaskIds = new mutable.HashMap[String, 
    -    // Number of tasks currently running on the cluster.  Should be 0 when 
no stages are active.
    +    // Number of tasks currently running on the cluster including 
speculative tasks.
    +    // Should be 0 when no stages are active.
         private var numRunningTasks: Int = _
    +    private val stageIdToNumSpeculativeTasks = new mutable.HashMap[Int, 
    --- End diff --
    at the first glance I thought `stageIdToNumSpeculativeTasks` is just 
`stageIdToSpeculativeTaskIndices.mapValues(_.size)`, but seems it's not true, 
can you add some comments to explain these 2 variables?

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

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to