pgandhi999 commented on a change in pull request #23677: 
[SPARK-26755][SCHEDULER] : Optimize Spark Scheduler to dequeue speculative 
tasks…
URL: https://github.com/apache/spark/pull/23677#discussion_r301754427
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala
 ##########
 @@ -371,107 +304,64 @@ private[spark] class TaskSetManager(
     }
   }
 
-  /**
-   * Return a speculative task for a given executor if any are available. The 
task should not have
-   * an attempt running on this host, in case the host is slow. In addition, 
the task should meet
-   * the given locality constraint.
-   */
-  // Labeled as protected to allow tests to override providing speculative 
tasks if necessary
-  protected def dequeueSpeculativeTask(execId: String, host: String, locality: 
TaskLocality.Value)
-    : Option[(Int, TaskLocality.Value)] =
-  {
-      // Check for process-local tasks; note that tasks can be process-local
-      // on multiple nodes when we replicate cached blocks, as in Spark 
Streaming
-    for (index <- dequeueTaskFromList(
-      execId, host, pendingSpeculatableTasks.forExecutor.getOrElse(execId, 
ArrayBuffer()),
-      speculative = true)) {
-      return Some((index, TaskLocality.PROCESS_LOCAL))
-    }
-
-    // Check for node-local tasks
-    if (TaskLocality.isAllowed(locality, TaskLocality.NODE_LOCAL)) {
-      for (index <- dequeueTaskFromList(
-        execId, host, pendingSpeculatableTasks.forHost.getOrElse(host, 
ArrayBuffer()),
-        speculative = true)) {
-        return Some((index, TaskLocality.NODE_LOCAL))
-      }
-    }
-
-    // Check for no-preference tasks
-    if (TaskLocality.isAllowed(locality, TaskLocality.NO_PREF)) {
-      for (index <- dequeueTaskFromList(
-        execId, host, pendingSpeculatableTasks.noPrefs, speculative = true)) {
-        return Some((index, TaskLocality.PROCESS_LOCAL))
-      }
-    }
-
-    // Check for rack-local tasks
-    if (TaskLocality.isAllowed(locality, TaskLocality.RACK_LOCAL)) {
-      for {
-        rack <- sched.getRackForHost(host)
-        index <- dequeueTaskFromList(
-          execId, host, pendingSpeculatableTasks.forRack.getOrElse(rack, 
ArrayBuffer()),
-          speculative = true)
-      } {
-        return Some((index, TaskLocality.RACK_LOCAL))
-      }
-    }
-
-    // Check for non-local tasks
-    if (TaskLocality.isAllowed(locality, TaskLocality.ANY)) {
-      for (index <- dequeueTaskFromList(execId, host, 
pendingSpeculatableTasks.anyPrefs,
-        speculative = true)) {
-        return Some((index, TaskLocality.ANY))
-      }
-    }
-
-    None
-  }
-
   /**
    * Dequeue a pending task for a given node and return its index and locality 
level.
    * Only search for tasks matching the given locality constraint.
    *
    * @return An option containing (task index within the task set, locality, 
is speculative?)
    */
   private def dequeueTask(execId: String, host: String, maxLocality: 
TaskLocality.Value)
-    : Option[(Int, TaskLocality.Value, Boolean)] =
-  {
-    for (index <- dequeueTaskFromList(execId, host, 
getPendingTasksForExecutor(execId))) {
-      return Some((index, TaskLocality.PROCESS_LOCAL, false))
+  : Option[(Int, TaskLocality.Value, Boolean)] = {
+    // if we didn't schedule a regular task, try to schedule a speculative one
 
 Review comment:
   makes sense, have modified the comment.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to