Skip to content
Snippets Groups Projects
Commit 3535b91d authored by Kay Ousterhout's avatar Kay Ousterhout
Browse files

[SPARK-11163] Remove unnecessary addPendingTask calls.

This commit removes unnecessary calls to addPendingTask in
TaskSetManager.executorLost. These calls are unnecessary: for
tasks that are still pending and haven't been launched, they're
still in all of the correct pending lists, so calling addPendingTask
has no effect. For tasks that are currently running (which may still be
in the pending lists, depending on how they were scheduled), we call
addPendingTask in handleFailedTask, so the calls at the beginning
of executorLost are redundant.

I think these calls are left over from when we re-computed the locality
levels in addPendingTask; now that we call recomputeLocality separately,
I don't think these are necessary.

Now that those calls are removed, the readding parameter in addPendingTask
is no longer necessary, so this commit also removes that parameter.

markhamstra can you take a look at this?

cc vanzin

Author: Kay Ousterhout <kayousterhout@gmail.com>

Closes #9154 from kayousterhout/SPARK-11163.
parent 7bb6d31c
No related branches found
No related tags found
No related merge requests found
...@@ -177,14 +177,11 @@ private[spark] class TaskSetManager( ...@@ -177,14 +177,11 @@ private[spark] class TaskSetManager(
var emittedTaskSizeWarning = false var emittedTaskSizeWarning = false
/** /** Add a task to all the pending-task lists that it should be on. */
* Add a task to all the pending-task lists that it should be on. If readding is set, we are private def addPendingTask(index: Int) {
* re-adding the task so only include it in each list if it's not already there. // Utility method that adds `index` to a list only if it's not already there
*/
private def addPendingTask(index: Int, readding: Boolean = false) {
// Utility method that adds `index` to a list only if readding=false or it's not already there
def addTo(list: ArrayBuffer[Int]) { def addTo(list: ArrayBuffer[Int]) {
if (!readding || !list.contains(index)) { if (!list.contains(index)) {
list += index list += index
} }
} }
...@@ -219,9 +216,7 @@ private[spark] class TaskSetManager( ...@@ -219,9 +216,7 @@ private[spark] class TaskSetManager(
addTo(pendingTasksWithNoPrefs) addTo(pendingTasksWithNoPrefs)
} }
if (!readding) { allPendingTasks += index // No point scanning this whole list to find the old task there
allPendingTasks += index // No point scanning this whole list to find the old task there
}
} }
/** /**
...@@ -783,18 +778,6 @@ private[spark] class TaskSetManager( ...@@ -783,18 +778,6 @@ private[spark] class TaskSetManager(
/** Called by TaskScheduler when an executor is lost so we can re-enqueue our tasks */ /** Called by TaskScheduler when an executor is lost so we can re-enqueue our tasks */
override def executorLost(execId: String, host: String, reason: ExecutorLossReason) { override def executorLost(execId: String, host: String, reason: ExecutorLossReason) {
logInfo("Re-queueing tasks for " + execId + " from TaskSet " + taskSet.id)
// Re-enqueue pending tasks for this host based on the status of the cluster. Note
// that it's okay if we add a task to the same queue twice (if it had multiple preferred
// locations), because dequeueTaskFromList will skip already-running tasks.
for (index <- getPendingTasksForExecutor(execId)) {
addPendingTask(index, readding = true)
}
for (index <- getPendingTasksForHost(host)) {
addPendingTask(index, readding = true)
}
// Re-enqueue any tasks that ran on the failed executor if this is a shuffle map stage, // Re-enqueue any tasks that ran on the failed executor if this is a shuffle map stage,
// and we are not using an external shuffle server which could serve the shuffle outputs. // and we are not using an external shuffle server which could serve the shuffle outputs.
// The reason is the next stage wouldn't be able to fetch the data from this dead executor // The reason is the next stage wouldn't be able to fetch the data from this dead executor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment