Github user jerryshao commented on a diff in the pull request:
https://github.com/apache/spark/pull/12236#discussion_r59108524
--- Diff:
streaming/src/test/scala/org/apache/spark/streaming/scheduler/ReceiverTrackerSuite.scala
---
@@ -102,6 +102,31 @@ class ReceiverTrackerSuite extends TestSuiteBase {
}
}
}
+
+ test("get allocated executors") {
+ // Test get allocated executors when 1 receiver is registered
+ withStreamingContext(new StreamingContext(conf, Milliseconds(100))) {
ssc =>
+ val input = ssc.receiverStream(new TestReceiver)
+ val output = new TestOutputStream(input)
+ output.register()
+ ssc.start()
+ eventually(timeout(10 seconds), interval(10 millis)) {
+ assert(ssc.scheduler.receiverTracker.allocatedExecutors().size ===
1)
+ }
+ }
+
+ // Test get allocated executors when there's no receiver registered
+ withStreamingContext(new StreamingContext(conf, Milliseconds(100))) {
ssc =>
+ val rdd = ssc.sc.parallelize(1 to 10)
+ val input = new ConstantInputDStream(ssc, rdd)
+ val output = new TestOutputStream(input)
+ output.register()
+ ssc.start()
+ eventually(timeout(10 seconds), interval(10 millis)) {
+ assert(ssc.scheduler.receiverTracker.allocatedExecutors() ===
Map.empty)
--- End diff --
>Before any receiver starts,
ssc.scheduler.receiverTracker.allocatedExecutors will return Map.empty as well.
I see your point, this might cause streaming dynamic allocation to kill the
executor which has a receiver to be started unexpectedly. This might be
happened in some extreme cases.
---
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]