You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "xianjingfeng (via GitHub)" <gi...@apache.org> on 2023/03/01 07:03:56 UTC

[GitHub] [incubator-uniffle] xianjingfeng commented on a diff in pull request #637: [#615] improvement: Reduce task binary by removing 'partitionToServers' from RssShuffleHandle

xianjingfeng commented on code in PR #637:
URL: https://github.com/apache/incubator-uniffle/pull/637#discussion_r1121241900


##########
client-spark/common/src/main/java/org/apache/spark/shuffle/RssSparkShuffleUtils.java:
##########
@@ -190,4 +200,33 @@ public static int getRequiredShuffleServerNumber(SparkConf sparkConf) {
     int taskConcurrencyPerServer = sparkConf.get(RssSparkConfig.RSS_ESTIMATE_TASK_CONCURRENCY_PER_SERVER);
     return (int) Math.ceil(estimateTaskConcurrency * 1.0 / taskConcurrencyPerServer);
   }
+
+  /**
+   * Get current active {@link SparkContext}. It should be called inside Driver since we don't mean to create any
+   * new {@link SparkContext} here.
+   *
+   * Note: We could use "SparkContext.getActive()" instead of "SparkContext.getOrCreate()" if the "getActive" method
+   * is not declared as package private in Scala.
+   * @return Active SparkContext created by Driver.
+   */
+  public static SparkContext getActiveSparkContext() {
+    return SparkContext.getOrCreate();
+  }
+
+  /**
+   * create broadcast variable of {@link ShuffleHandleInfo}
+   *
+   * @param sc                    expose for easy unit-test
+   * @param shuffleId
+   * @param partitionToServers
+   * @param storageInfo
+   * @return Broadcast variable registered for auto cleanup
+   */
+  public static Broadcast<byte[]> createPartShuffleServerMap(SparkContext sc, int shuffleId,
+      Map<Integer, List<ShuffleServerInfo>> partitionToServers, RemoteStorageInfo storageInfo) {
+    ShuffleHandleInfo partServerMap = new ShuffleHandleInfo(shuffleId, partitionToServers, storageInfo);

Review Comment:
   `partServerMap` should be changed  to a better name.



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

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org