Ngone51 commented on a change in pull request #27115:
[SPARK-30440][CORE][TESTS] Flaky test:
org.apache.spark.scheduler.TaskSetManagerSuite
URL: https://github.com/apache/spark/pull/27115#discussion_r364271853
##########
File path:
core/src/test/scala/org/apache/spark/scheduler/TaskSetManagerSuite.scala
##########
@@ -1928,16 +1929,18 @@ class TaskSetManagerSuite
// get the TaskSetManager
val manager =
sched.invokePrivate(taskSetManagers()).get(stageId).get(stageAttemptId)
- val task0 = manager.resourceOffer(exec0, "localhost", TaskLocality.NO_PREF)
- val task1 = manager.resourceOffer(exec1, "localhost", TaskLocality.NO_PREF)
- assert(task0.isDefined && task1.isDefined)
- val (taskId0, index0) = (task0.get.taskId, task0.get.index)
- val (taskId1, index1) = (task1.get.taskId, task1.get.index)
+ val (task0, task1) = eventually(timeout(10.seconds),
interval(100.milliseconds)) {
+ val task0 = Option(manager.taskInfos(0))
+ val task1 = Option(manager.taskInfos(1))
+ assert(task0.isDefined && task1.isDefined)
+ (task0, task1)
Review comment:
If task doesn't exist in `taskInfos`, it will throw exception instead of
`null`. You may want `manager.taskInfos.getOrElse(0, null)` instead. Or, I
think, just return `(manager.taskInfos(0), manager.taskInfos(1))` should be
fine.
----------------------------------------------------------------
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]