Skip to content

Commit 707307f

Browse files
committed
review feedback
1 parent 0720a7c commit 707307f

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ private[spark] class TaskSchedulerImpl(
692692
/**
693693
* Marks the task has completed in all TaskSetManagers for the given stage.
694694
*
695-
* After stage failure and retry, there may be multiple active TaskSetManagers for the stage.
695+
* After stage failure and retry, there may be multiple TaskSetManagers for the stage.
696696
* If an earlier attempt of a stage completes a task, we should ensure that the later attempts
697697
* do not also submit those same tasks. That also means that a task completion from an earlier
698698
* attempt can lead to the entire stage getting marked as successful.

core/src/test/scala/org/apache/spark/scheduler/TaskSchedulerImplSuite.scala

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -940,15 +940,13 @@ class TaskSchedulerImplSuite extends SparkFunSuite with LocalSparkContext with B
940940
val offers = (0 until 10).map{ idx => WorkerOffer(s"exec-$idx", s"host-$idx", 1) }
941941
taskScheduler.resourceOffers(offers)
942942
assert(tsm.runningTasks === 10)
943-
if (stageAttempt < 2) {
944-
// fail attempt
945-
tsm.handleFailedTask(tsm.taskAttempts.head.head.taskId, TaskState.FAILED,
946-
FetchFailed(null, 0, 0, 0, "fetch failed"))
947-
// the attempt is a zombie, but the tasks are still running (this could be true even if
948-
// we actively killed those tasks, as killing is best-effort)
949-
assert(tsm.isZombie)
950-
assert(tsm.runningTasks === 9)
951-
}
943+
// fail attempt
944+
tsm.handleFailedTask(tsm.taskAttempts.head.head.taskId, TaskState.FAILED,
945+
FetchFailed(null, 0, 0, 0, "fetch failed"))
946+
// the attempt is a zombie, but the tasks are still running (this could be true even if
947+
// we actively killed those tasks, as killing is best-effort)
948+
assert(tsm.isZombie)
949+
assert(tsm.runningTasks === 9)
952950
tsm
953951
}
954952

@@ -979,8 +977,7 @@ class TaskSchedulerImplSuite extends SparkFunSuite with LocalSparkContext with B
979977
assert(
980978
taskScheduler.resourceOffers(IndexedSeq(WorkerOffer("exec-1", "host-1", 1))).flatten.isEmpty)
981979

982-
val allTaskSets = zombieAttempts ++ Seq(finalTsm)
983-
val remainingTasks = (0 until 10).toSet.diff(finalAttemptPendingPartitions)
980+
val remainingTasks = (0 until 10).toSet.diff(finalAttemptPendingPartitions).toIndexedSeq.sorted
984981

985982
// finally, if we finish the remaining partitions from a mix of tasksets, all attempts should be
986983
// marked as zombie.

0 commit comments

Comments
 (0)