Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/7276#discussion_r34526581
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/scheduler/ReceiverTracker.scala
---
@@ -343,24 +378,61 @@ class ReceiverTracker(ssc: StreamingContext,
skipReceiverLaunch: Boolean = false
ssc.sparkContext.makeRDD(1 to 50, 50).map(x => (x,
1)).reduceByKey(_ + _, 20).collect()
}
- // Get the list of executors and schedule receivers
- val executors = getExecutors(ssc)
- val tempRDD =
- if (!executors.isEmpty) {
- val locations = scheduleReceivers(receivers, executors)
- val roundRobinReceivers = (0 until receivers.length).map(i =>
- (receivers(i), locations(i)))
- ssc.sc.makeRDD[Receiver[_]](roundRobinReceivers)
- } else {
- ssc.sc.makeRDD(receivers, receivers.size)
- }
-
// Distribute the receivers and start them
logInfo("Starting " + receivers.length + " receivers")
running = true
- ssc.sparkContext.runJob(tempRDD,
ssc.sparkContext.clean(startReceiver))
+ for (receiver <- receivers) {
+ submitJobThread.execute(new Runnable {
+ override def run(): Unit = {
+ if (stopping) {
+ receiverExitLatch.countDown()
+ return
+ }
+
+ val self = this
+ val receiverId = receiver.streamId
+ val scheduledLocations = scheduler.scheduleReceiver(
+ receiverId,
+ receiver.preferredLocation,
+ getReceiverTrackingInfoMap(),
+ getExecutors(ssc))
+ updateReceiverScheduledLocations(receiver.streamId,
scheduledLocations)
+ val receiverRDD: RDD[Receiver[_]] =
+ if (scheduledLocations.isEmpty) {
+ ssc.sc.makeRDD(Seq(receiver), 1)
+ } else {
+ ssc.sc.makeRDD(Seq(receiver -> scheduledLocations))
+ }
+ val future = ssc.sparkContext.submitAsyncJob[Receiver[_],
Unit, Unit](
+ receiverRDD, startReceiver, (_, _) => Unit, ())
+ // TODO Refactor JobWaiter to avoid creating a new Thread
here. Otherwise, it's not
--- End diff --
This TODO needs to be removed.
---
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]