Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9181#discussion_r43066104
  
    --- Diff: 
streaming/src/test/scala/org/apache/spark/streaming/scheduler/ReceiverSchedulingPolicySuite.scala
 ---
    @@ -20,73 +20,102 @@ package org.apache.spark.streaming.scheduler
     import scala.collection.mutable
     
     import org.apache.spark.SparkFunSuite
    +import org.apache.spark.scheduler.{ExecutorCacheTaskLocation, 
HostTaskLocation, TaskLocation}
     
     class ReceiverSchedulingPolicySuite extends SparkFunSuite {
     
       val receiverSchedulingPolicy = new ReceiverSchedulingPolicy
     
       test("rescheduleReceiver: empty executors") {
    -    val scheduledExecutors =
    +    val scheduledLocations =
           receiverSchedulingPolicy.rescheduleReceiver(0, None, Map.empty, 
executors = Seq.empty)
    -    assert(scheduledExecutors === Seq.empty)
    +    assert(scheduledLocations === Seq.empty)
       }
     
       test("rescheduleReceiver: receiver preferredLocation") {
    +    val executors = Seq(ExecutorCacheTaskLocation("host2", "2"))
         val receiverTrackingInfoMap = Map(
           0 -> ReceiverTrackingInfo(0, ReceiverState.INACTIVE, None, None))
    -    val scheduledExecutors = receiverSchedulingPolicy.rescheduleReceiver(
    -      0, Some("host1"), receiverTrackingInfoMap, executors = Seq("host2"))
    -    assert(scheduledExecutors.toSet === Set("host1", "host2"))
    +    val scheduledLocations = receiverSchedulingPolicy.rescheduleReceiver(
    +      0, Some("host1"), receiverTrackingInfoMap, executors)
    +    assert(scheduledLocations.toSet === Set(HostTaskLocation("host1"), 
executors(0)))
       }
     
       test("rescheduleReceiver: return all idle executors if there are any 
idle executors") {
    -    val executors = Seq("host1", "host2", "host3", "host4", "host5")
    -    // host3 is idle
    +    val executors = Seq(
    +      ExecutorCacheTaskLocation("host1", "1"),
    +      ExecutorCacheTaskLocation("host2", "2"),
    +      ExecutorCacheTaskLocation("host3", "3"),
    +      ExecutorCacheTaskLocation("host4", "4"),
    +      ExecutorCacheTaskLocation("host5", "5")
    +    )
    --- End diff --
    
    I this can be replaced with `(1 to 5).map { i => 
ExecutorCacheTaskLocation(s"host$i", s"$i") }`


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to