You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2017/08/07 08:50:25 UTC

[GitHub] spark pull request #18492: [SPARK-19326] Speculated task attempts do not get...

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

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