Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18492#discussion_r131602232
  
    --- 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, 
hostToLocalTaskCount)
    +    if (addRequestAcknowledged) {
    +      logInfo(s"Requesting one new executor because speculative tasks are 
backlogged")
    +    }
    +  }
    +
    +  /**
        * 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, 
mutable.HashSet[Int]]
         private val executorIdToTaskIds = new mutable.HashMap[String, 
mutable.HashSet[Long]]
    -    // 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, 
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 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