Github user squito commented on a diff in the pull request: https://github.com/apache/spark/pull/8760#discussion_r42044542 --- Diff: core/src/test/scala/org/apache/spark/scheduler/BlacklistTrackerSuite.scala --- @@ -0,0 +1,162 @@ +package org.apache.spark.scheduler + +import org.apache.spark.SparkFunSuite +import org.scalatest.BeforeAndAfter +import org.apache.spark.SparkConf +import org.apache.spark.TaskEndReason +import org.apache.spark.Success +import org.apache.spark.ExceptionFailure +import org.apache.spark.LocalSparkContext +import org.apache.spark.SparkContext + +import org.mockito.Mockito.{when,spy} + +class BlacklistTrackerSuite extends SparkFunSuite with BeforeAndAfter with LocalSparkContext { + + val FAILURE: TaskEndReason = new ExceptionFailure( + "Fake", + "fake failure", + Array.empty[StackTraceElement], + "fake stack trace", + None, + None) + + // Variable name can indicate basic information of taskInfo + // The format is "taskInfo_executorId_taskId_hostName" + val taskInfo_1_1_hostA = new TaskInfo(1L,1,1,0L,"1","hostA", TaskLocality.ANY, false) + val taskInfo_1_2_hostA = new TaskInfo(2L,1,1,0L,"1","hostA", TaskLocality.ANY, false) + val taskInfo_2_1_hostA = new TaskInfo(1L,1,1,0L,"2","hostA", TaskLocality.ANY, false) + val taskInfo_2_2_hostA = new TaskInfo(2L,1,1,0L,"2","hostA", TaskLocality.ANY, false) + val taskInfo_3_3_hostB = new TaskInfo(3L,1,1,0L,"3","hostB", TaskLocality.ANY, false) + + test ("expireExecutorsInBlacklist works ") { + val conf = new SparkConf().setAppName("test").setMaster("local") + .set("spark.ui.enabled","false") + .set("spark.scheduler.blacklist.recoverPeriod", "2") + sc = new SparkContext(conf) + val scheduler = new TaskSchedulerImpl(sc, 1) + + val tracker = new BlacklistTracker(conf) + tracker.start() + Thread.sleep(100) + tracker.updateFailureExecutors(taskInfo_1_1_hostA, FAILURE) + assert(tracker.executorBlacklist(scheduler, 1L) === Set("1")) + + // sleep 2 second to wait for expireExecutorsInBlackList be triggered + Thread.sleep(2000) + assert(tracker.executorBlacklist(scheduler, 1L) === Set()) + + tracker.stop() + } + + test("default strategy works as exceptation") { --- End diff -- typo: expectation (I think that is what you mean) but actually, might as well just rename to simply "default strategy works"
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org