Skip to content

Commit 88e328d

Browse files
committed
fix TaskSchedulerImplSuite
1 parent 99e503c commit 88e328d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ class TaskSchedulerImplSuite extends SparkFunSuite with LocalSparkContext with B
7777
}
7878

7979
def setupScheduler(confs: (String, String)*): TaskSchedulerImpl = {
80-
val conf = new SparkConf().setMaster("local").setAppName("TaskSchedulerImplSuite")
80+
setupSchedulerWithMaster("local", confs: _*)
81+
}
82+
83+
def setupSchedulerWithMaster(master: String, confs: (String, String)*): TaskSchedulerImpl = {
84+
val conf = new SparkConf().setMaster(master).setAppName("TaskSchedulerImplSuite")
8185
confs.foreach { case (k, v) => conf.set(k, v) }
8286
sc = new SparkContext(conf)
8387
taskScheduler = new TaskSchedulerImpl(sc)
@@ -1129,7 +1133,7 @@ class TaskSchedulerImplSuite extends SparkFunSuite with LocalSparkContext with B
11291133
// you'd need the previous stage to also get restarted, and then succeed, in between each
11301134
// attempt, but that happens outside what we're mocking here.)
11311135
val zombieAttempts = (0 until 2).map { stageAttempt =>
1132-
val attempt = FakeTask.createTaskSet(10, stageAttemptId = stageAttempt)
1136+
val attempt = FakeTask.createTaskSet(10, stageId = 0, stageAttemptId = stageAttempt)
11331137
taskScheduler.submitTasks(attempt)
11341138
val tsm = taskScheduler.taskSetManagerForAttempt(0, stageAttempt).get
11351139
val offers = (0 until 10).map{ idx => WorkerOffer(s"exec-$idx", s"host-$idx", 1) }
@@ -1148,7 +1152,7 @@ class TaskSchedulerImplSuite extends SparkFunSuite with LocalSparkContext with B
11481152
// we've now got 2 zombie attempts, each with 9 tasks still active. Submit the 3rd attempt for
11491153
// the stage, but this time with insufficient resources so not all tasks are active.
11501154

1151-
val finalAttempt = FakeTask.createTaskSet(10, stageAttemptId = 2)
1155+
val finalAttempt = FakeTask.createTaskSet(10, stageId = 0, stageAttemptId = 2)
11521156
taskScheduler.submitTasks(finalAttempt)
11531157
val finalTsm = taskScheduler.taskSetManagerForAttempt(0, 2).get
11541158
val offers = (0 until 5).map{ idx => WorkerOffer(s"exec-$idx", s"host-$idx", 1) }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ class TaskSetManagerSuite extends SparkFunSuite with LocalSparkContext with Logg
13981398
assert(taskSetManager1.isZombie)
13991399
assert(taskSetManager1.runningTasks === 9)
14001400

1401-
val taskSet2 = FakeTask.createTaskSet(10, stageAttemptId = 1)
1401+
val taskSet2 = FakeTask.createTaskSet(10, stageId = 0, stageAttemptId = 1)
14021402
sched.submitTasks(taskSet2)
14031403
sched.resourceOffers(
14041404
(11 until 20).map { idx => WorkerOffer(s"exec-$idx", s"host-$idx", 1) })

0 commit comments

Comments
 (0)