venkata91 commented on a change in pull request #30164: URL: https://github.com/apache/spark/pull/30164#discussion_r518402471
########## File path: resource-managers/yarn/src/main/scala/org/apache/spark/scheduler/cluster/YarnSchedulerBackend.scala ########## @@ -161,6 +170,27 @@ private[spark] abstract class YarnSchedulerBackend( totalRegisteredExecutors.get() >= totalExpectedExecutors * minRegisteredRatio } + override def getMergerLocations( + numPartitions: Int, + resourceProfileId: Int): Seq[BlockManagerId] = { + // Currently this is naive way of calculating numMergersNeeded for a stage. In future, + // we can use better heuristics to calculate numMergersNeeded for a stage. + val tasksPerExecutor = sc.resourceProfileManager + .resourceProfileFromId(resourceProfileId).maxTasksPerExecutor(sc.conf) + val numMergersNeeded = math.min( + math.max(1, math.ceil(numPartitions / tasksPerExecutor).toInt), maxNumExecutors) + val minMergersThreshold = math.max(minMergersStaticThreshold, + math.floor(numMergersNeeded * minMergersThresholdRatio).toInt) Review comment: > So if numMergersNeeded=3 and minMergersThreshold=5 and mergers returned from BlockManagerMaster is 100, you want to return the 100 mergers here? If so, it doesn't look reasonable. In that case would only request `numMergersNeeded` mergers to `BlockManagerMaster` which is `3` not `100`. Let me know if this clarifies it or not. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org