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

    https://github.com/apache/spark/pull/7276#discussion_r35287066
  
    --- 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)
    +    }
    +    receiverTrackingInfos.put(receiverId, newReceiverTrackingInfo)
    +  }
    +
       /** Check if any blocks are left to be processed */
       def hasUnallocatedBlocks: Boolean = {
         receivedBlockTracker.hasUnallocatedReceivedBlocks
       }
     
    +  /**
    +   * Get the list of executors excluding driver
    +   */
    +  private def getExecutors: Seq[String] = {
    --- End diff --
    
    Isnt it easier to return the (host, port) split, so that you dnt have to 
split it later in the scheduling policy. Either way I am fine, just think about 
it.


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