@@ -22,7 +22,7 @@ import scala.collection.mutable
2222import org .scalatest .{FunSuite , PrivateMethodTester }
2323import org .apache .spark .executor .TaskMetrics
2424import org .apache .spark .scheduler ._
25- import org .apache .spark .storage . BlockManagerId
25+ import org .apache .spark .scheduler . cluster . ExecutorInfo
2626
2727/**
2828 * Test add and remove behavior of ExecutorAllocationManager.
@@ -144,8 +144,8 @@ class ExecutorAllocationManagerSuite extends FunSuite with LocalSparkContext {
144144
145145 // Verify that running a task reduces the cap
146146 sc.listenerBus.postToAll(SparkListenerStageSubmitted (createStageInfo(1 , 3 )))
147- sc.listenerBus.postToAll(SparkListenerBlockManagerAdded (
148- 0L , BlockManagerId ( " executor-1" , " host1" , 1 ), 100L ))
147+ sc.listenerBus.postToAll(SparkListenerExecutorAdded (
148+ 0L , " executor-1" , new ExecutorInfo ( " host1" , 1 )))
149149 sc.listenerBus.postToAll(SparkListenerTaskStart (1 , 0 , createTaskInfo(0 , 0 , " executor-1" )))
150150 assert(numExecutorsPending(manager) === 4 )
151151 assert(addExecutors(manager) === 1 )
@@ -578,30 +578,28 @@ class ExecutorAllocationManagerSuite extends FunSuite with LocalSparkContext {
578578 assert(removeTimes(manager).isEmpty)
579579
580580 // New executors have registered
581- sc.listenerBus.postToAll(SparkListenerBlockManagerAdded (
582- 0L , BlockManagerId ( " executor-1" , " host1" , 1 ), 100L ))
581+ sc.listenerBus.postToAll(SparkListenerExecutorAdded (
582+ 0L , " executor-1" , new ExecutorInfo ( " host1" , 1 )))
583583 assert(executorIds(manager).size === 1 )
584584 assert(executorIds(manager).contains(" executor-1" ))
585585 assert(removeTimes(manager).size === 1 )
586586 assert(removeTimes(manager).contains(" executor-1" ))
587- sc.listenerBus.postToAll(SparkListenerBlockManagerAdded (
588- 0L , BlockManagerId ( " executor-2" , " host2" , 1 ), 100L ))
587+ sc.listenerBus.postToAll(SparkListenerExecutorAdded (
588+ 0L , " executor-2" , new ExecutorInfo ( " host2" , 1 )))
589589 assert(executorIds(manager).size === 2 )
590590 assert(executorIds(manager).contains(" executor-2" ))
591591 assert(removeTimes(manager).size === 2 )
592592 assert(removeTimes(manager).contains(" executor-2" ))
593593
594594 // Existing executors have disconnected
595- sc.listenerBus.postToAll(SparkListenerBlockManagerRemoved (
596- 0L , BlockManagerId (" executor-1" , " host1" , 1 )))
595+ sc.listenerBus.postToAll(SparkListenerExecutorRemoved (0L , " executor-1" , " " ))
597596 assert(executorIds(manager).size === 1 )
598597 assert(! executorIds(manager).contains(" executor-1" ))
599598 assert(removeTimes(manager).size === 1 )
600599 assert(! removeTimes(manager).contains(" executor-1" ))
601600
602601 // Unknown executor has disconnected
603- sc.listenerBus.postToAll(SparkListenerBlockManagerRemoved (
604- 0L , BlockManagerId (" executor-3" , " host3" , 1 )))
602+ sc.listenerBus.postToAll(SparkListenerExecutorRemoved (0L , " executor-3" , " " ))
605603 assert(executorIds(manager).size === 1 )
606604 assert(removeTimes(manager).size === 1 )
607605 }
@@ -613,8 +611,8 @@ class ExecutorAllocationManagerSuite extends FunSuite with LocalSparkContext {
613611 assert(removeTimes(manager).isEmpty)
614612
615613 sc.listenerBus.postToAll(SparkListenerTaskStart (0 , 0 , createTaskInfo(0 , 0 , " executor-1" )))
616- sc.listenerBus.postToAll(SparkListenerBlockManagerAdded (
617- 0L , BlockManagerId ( " executor-1" , " host1" , 1 ), 100L ))
614+ sc.listenerBus.postToAll(SparkListenerExecutorAdded (
615+ 0L , " executor-1" , new ExecutorInfo ( " host1" , 1 )))
618616 assert(executorIds(manager).size === 1 )
619617 assert(executorIds(manager).contains(" executor-1" ))
620618 assert(removeTimes(manager).size === 0 )
@@ -625,16 +623,16 @@ class ExecutorAllocationManagerSuite extends FunSuite with LocalSparkContext {
625623 val manager = sc.executorAllocationManager.get
626624 assert(executorIds(manager).isEmpty)
627625 assert(removeTimes(manager).isEmpty)
628- sc.listenerBus.postToAll(SparkListenerBlockManagerAdded (
629- 0L , BlockManagerId ( " executor-1" , " host1" , 1 ), 100L ))
626+ sc.listenerBus.postToAll(SparkListenerExecutorAdded (
627+ 0L , " executor-1" , new ExecutorInfo ( " host1" , 1 )))
630628 sc.listenerBus.postToAll(SparkListenerTaskStart (0 , 0 , createTaskInfo(0 , 0 , " executor-1" )))
631629
632630 assert(executorIds(manager).size === 1 )
633631 assert(executorIds(manager).contains(" executor-1" ))
634632 assert(removeTimes(manager).size === 0 )
635633
636- sc.listenerBus.postToAll(SparkListenerBlockManagerAdded (
637- 0L , BlockManagerId ( " executor-2" , " host1" , 1 ), 100L ))
634+ sc.listenerBus.postToAll(SparkListenerExecutorAdded (
635+ 0L , " executor-2" , new ExecutorInfo ( " host1" , 1 )))
638636 assert(executorIds(manager).size === 2 )
639637 assert(executorIds(manager).contains(" executor-2" ))
640638 assert(removeTimes(manager).size === 1 )
0 commit comments