@@ -880,8 +880,8 @@ class TaskSetManagerSuite extends SparkFunSuite with LocalSparkContext with Logg
880880 assert(manager.resourceOffer(" execB" , " host2" , ANY ).get.index === 3 )
881881 }
882882
883- test(" speculative task should not run on a given host where another attempt " +
884- " is already running on" ) {
883+ test(" SPARK-23888: speculative task should not run on a given host " +
884+ " where another attempt is already running on" ) {
885885 sc = new SparkContext (" local" , " test" )
886886 sched = new FakeTaskScheduler (
887887 sc, (" execA" , " host1" ), (" execB" , " host2" ))
@@ -893,7 +893,7 @@ class TaskSetManagerSuite extends SparkFunSuite with LocalSparkContext with Logg
893893 // let task0.0 run on host1
894894 assert(manager.resourceOffer(" execA" , " host1" , PROCESS_LOCAL ).get.index == 0 )
895895 val info1 = manager.taskAttempts(0 )(0 )
896- assert(info1.running === true )
896+ assert(info1.running)
897897 assert(info1.host === " host1" )
898898
899899 // long time elapse, and task0.0 is still running,
@@ -902,7 +902,7 @@ class TaskSetManagerSuite extends SparkFunSuite with LocalSparkContext with Logg
902902 manager.speculatableTasks += 0
903903 assert(manager.resourceOffer(" execB" , " host2" , PROCESS_LOCAL ).get.index === 0 )
904904 val info2 = manager.taskAttempts(0 )(0 )
905- assert(info2.running === true )
905+ assert(info2.running)
906906 assert(info2.host === " host2" )
907907 assert(manager.speculatableTasks.size === 0 )
908908
@@ -917,7 +917,8 @@ class TaskSetManagerSuite extends SparkFunSuite with LocalSparkContext with Logg
917917 // there's already a running copy.
918918 clock.advance(1000 )
919919 info1.finishTime = clock.getTimeMillis()
920- assert(info1.running === false )
920+ manager.handleFailedTask(info1.taskId, TaskState .FAILED , UnknownReason )
921+ assert(! info1.running)
921922
922923 // time goes on, and task0.1 is still running
923924 clock.advance(1000 )
@@ -928,7 +929,7 @@ class TaskSetManagerSuite extends SparkFunSuite with LocalSparkContext with Logg
928929 // no more running copy of task0
929930 assert(manager.resourceOffer(" execA" , " host1" , PROCESS_LOCAL ).get.index === 0 )
930931 val info3 = manager.taskAttempts(0 )(0 )
931- assert(info3.running === true )
932+ assert(info3.running)
932933 assert(info3.host === " host1" )
933934 assert(manager.speculatableTasks.size === 0 )
934935 }
0 commit comments