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

    https://github.com/apache/spark/pull/9075#discussion_r42310297
  
    --- Diff: 
streaming/src/test/scala/org/apache/spark/streaming/scheduler/ReceiverTrackerSuite.scala
 ---
    @@ -80,6 +82,28 @@ class ReceiverTrackerSuite extends TestSuiteBase {
           }
         }
       }
    +
    +  test("SPARK-11063: TaskSetManager should use Receiver RDD's 
preferredLocations") {
    +    // Use ManualClock to prevent from starting batches so that we can 
make sure the only task is
    +    // for starting the Receiver
    +    val _conf = conf.clone.set("spark.streaming.clock", 
"org.apache.spark.util.ManualClock")
    +    withStreamingContext(new StreamingContext(_conf, Milliseconds(100))) { 
ssc =>
    +      @volatile var receiverTaskLocality: TaskLocality = null
    +      ssc.sparkContext.addSparkListener(new SparkListener {
    +        override def onTaskStart(taskStart: SparkListenerTaskStart): Unit 
= {
    +          receiverTaskLocality = taskStart.taskInfo.taskLocality
    +        }
    +      })
    +      val input = ssc.receiverStream(new TestReceiver)
    +      val output = new TestOutputStream(input)
    +      output.register()
    +      ssc.start()
    +      eventually(timeout(10 seconds), interval(10 millis)) {
    +        // If preferredLocations is set correctly, receiverTaskLocality 
should be NODE_LOCAL
    +        assert(receiverTaskLocality === TaskLocality.NODE_LOCAL)
    --- End diff --
    
    It's `TaskLocality.ANY` without this patch.


---
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

Reply via email to