@@ -88,7 +88,7 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
8888 test(" TaskSet with no preferences" ) {
8989 sc = new SparkContext (" local" , " test" )
9090 val sched = new FakeTaskScheduler (sc, (" exec1" , " host1" ))
91- val taskSet = createTaskSet(1 )
91+ val taskSet = FakeTask . createTaskSet(1 )
9292 val manager = new TaskSetManager (sched, taskSet, MAX_TASK_FAILURES )
9393
9494 // Offer a host with no CPUs
@@ -114,7 +114,7 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
114114 test(" multiple offers with no preferences" ) {
115115 sc = new SparkContext (" local" , " test" )
116116 val sched = new FakeTaskScheduler (sc, (" exec1" , " host1" ))
117- val taskSet = createTaskSet(3 )
117+ val taskSet = FakeTask . createTaskSet(3 )
118118 val manager = new TaskSetManager (sched, taskSet, MAX_TASK_FAILURES )
119119
120120 // First three offers should all find tasks
@@ -145,7 +145,7 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
145145 test(" basic delay scheduling" ) {
146146 sc = new SparkContext (" local" , " test" )
147147 val sched = new FakeTaskScheduler (sc, (" exec1" , " host1" ), (" exec2" , " host2" ))
148- val taskSet = createTaskSet(4 ,
148+ val taskSet = FakeTask . createTaskSet(4 ,
149149 Seq (TaskLocation (" host1" , " exec1" )),
150150 Seq (TaskLocation (" host2" , " exec2" )),
151151 Seq (TaskLocation (" host1" ), TaskLocation (" host2" , " exec2" )),
@@ -190,7 +190,7 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
190190 sc = new SparkContext (" local" , " test" )
191191 val sched = new FakeTaskScheduler (sc,
192192 (" exec1" , " host1" ), (" exec2" , " host2" ), (" exec3" , " host3" ))
193- val taskSet = createTaskSet(5 ,
193+ val taskSet = FakeTask . createTaskSet(5 ,
194194 Seq (TaskLocation (" host1" )),
195195 Seq (TaskLocation (" host2" )),
196196 Seq (TaskLocation (" host2" )),
@@ -229,7 +229,7 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
229229 test(" delay scheduling with failed hosts" ) {
230230 sc = new SparkContext (" local" , " test" )
231231 val sched = new FakeTaskScheduler (sc, (" exec1" , " host1" ), (" exec2" , " host2" ))
232- val taskSet = createTaskSet(3 ,
232+ val taskSet = FakeTask . createTaskSet(3 ,
233233 Seq (TaskLocation (" host1" )),
234234 Seq (TaskLocation (" host2" )),
235235 Seq (TaskLocation (" host3" ))
@@ -261,7 +261,7 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
261261 test(" task result lost" ) {
262262 sc = new SparkContext (" local" , " test" )
263263 val sched = new FakeTaskScheduler (sc, (" exec1" , " host1" ))
264- val taskSet = createTaskSet(1 )
264+ val taskSet = FakeTask . createTaskSet(1 )
265265 val clock = new FakeClock
266266 val manager = new TaskSetManager (sched, taskSet, MAX_TASK_FAILURES , clock)
267267
@@ -278,7 +278,7 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
278278 test(" repeated failures lead to task set abortion" ) {
279279 sc = new SparkContext (" local" , " test" )
280280 val sched = new FakeTaskScheduler (sc, (" exec1" , " host1" ))
281- val taskSet = createTaskSet(1 )
281+ val taskSet = FakeTask . createTaskSet(1 )
282282 val clock = new FakeClock
283283 val manager = new TaskSetManager (sched, taskSet, MAX_TASK_FAILURES , clock)
284284
@@ -298,21 +298,6 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
298298 }
299299 }
300300
301-
302- /**
303- * Utility method to create a TaskSet, potentially setting a particular sequence of preferred
304- * locations for each task (given as varargs) if this sequence is not empty.
305- */
306- def createTaskSet (numTasks : Int , prefLocs : Seq [TaskLocation ]* ): TaskSet = {
307- if (prefLocs.size != 0 && prefLocs.size != numTasks) {
308- throw new IllegalArgumentException (" Wrong number of task locations" )
309- }
310- val tasks = Array .tabulate[Task [_]](numTasks) { i =>
311- new FakeTask (i, if (prefLocs.size != 0 ) prefLocs(i) else Nil )
312- }
313- new TaskSet (tasks, 0 , 0 , 0 , null )
314- }
315-
316301 def createTaskResult (id : Int ): DirectTaskResult [Int ] = {
317302 val valueSer = SparkEnv .get.serializer.newInstance()
318303 new DirectTaskResult [Int ](valueSer.serialize(id), mutable.Map .empty, new TaskMetrics )
0 commit comments