Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/7276#discussion_r35286791
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/scheduler/ReceiverTracker.scala
---
@@ -258,171 +319,242 @@ class ReceiverTracker(ssc: StreamingContext,
skipReceiverLaunch: Boolean = false
logWarning(s"Error reported by receiver for stream $streamId:
$messageWithError")
}
+ private def scheduleReceiver(receiverId: Int): Seq[String] = {
+ val preferredLocation =
receiverPreferredLocations.getOrElse(receiverId, None)
+ val scheduledLocations = schedulingPolicy.rescheduleReceiver(
+ receiverId, preferredLocation, receiverTrackingInfos, getExecutors)
+ updateReceiverScheduledLocations(receiverId, scheduledLocations)
+ scheduledLocations
+ }
+
+ private def updateReceiverScheduledLocations(
+ receiverId: Int, scheduledLocations: Seq[String]): Unit = {
+ val newReceiverTrackingInfo = receiverTrackingInfos.get(receiverId)
match {
+ case Some(oldInfo) =>
+ oldInfo.copy(state = ReceiverState.SCHEDULED,
+ scheduledLocations = Some(scheduledLocations))
+ case None =>
+ ReceiverTrackingInfo(
+ receiverId,
+ ReceiverState.SCHEDULED,
+ Some(scheduledLocations),
+ None)
--- End diff --
nit: What is none for? Could you write it as `xyz = None`? Easier to read.
---
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]