Skip to content

Commit ac7b612

Browse files
committed
fix the test changes
1 parent 6fc74b3 commit ac7b612

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,21 +1007,22 @@ class TaskSchedulerImplSuite extends SparkFunSuite with LocalSparkContext with B
10071007
config.UNSCHEDULABLE_TASKSET_TIMEOUT.key -> "0",
10081008
config.DYN_ALLOCATION_ENABLED.key -> "true")
10091009

1010-
// We have only 1 task remaining with 1 executor
1011-
val taskSet = FakeTask.createTaskSet(numTasks = 1)
1010+
// We have 2 tasks remaining with 1 executor
1011+
val taskSet = FakeTask.createTaskSet(numTasks = 2)
10121012
taskScheduler.submitTasks(taskSet)
10131013
val tsm = stageToMockTaskSetManager(0)
10141014

10151015
// submit an offer with one executor
1016-
val firstTaskAttempts = taskScheduler.resourceOffers(IndexedSeq(
1017-
WorkerOffer("executor0", "host0", 1)
1018-
)).flatten
1016+
taskScheduler.resourceOffers(IndexedSeq(WorkerOffer("executor0", "host0", 2))).flatten
10191017

10201018
// Fail the running task
1021-
val failedTask = firstTaskAttempts.find(_.executorId == "executor0").get
1022-
failTask(failedTask.taskId, TaskState.FAILED, UnknownReason, tsm)
1019+
failTask(0, TaskState.FAILED, UnknownReason, tsm)
10231020
when(tsm.taskSetBlacklistHelperOpt.get.isExecutorBlacklistedForTask(
1024-
"executor0", failedTask.index)).thenReturn(true)
1021+
"executor0", 0)).thenReturn(true)
1022+
1023+
// If the executor is busy, then dynamic allocation should kick in and try
1024+
// to acquire additional executors to schedule the blacklisted task
1025+
assert(taskScheduler.isExecutorBusy("executor0"))
10251026

10261027
// make an offer on the blacklisted executor. We won't schedule anything, and set the abort
10271028
// timer to kick in immediately

0 commit comments

Comments
 (0)