turboFei commented on code in PR #3203:
URL: https://github.com/apache/celeborn/pull/3203#discussion_r2032384003


##########
client-spark/common/src/main/java/org/apache/spark/shuffle/celeborn/SortBasedPusher.java:
##########
@@ -518,4 +532,48 @@ public void close(boolean throwTaskKilledOnInterruption) 
throws IOException {
   public long getUsed() {
     return super.getUsed();
   }
+
+  //
+
+  /**
+   * Calculates max memory conf based on SparkConf settings. Follows logic in 
Spark
+   * UnifiedMemoryManager.getMaxMemory:
+   * 
github.com/apache/spark/blob/branch-3.3/core/src/main/scala/org/apache/spark/memory/UnifiedMemoryManager.scala#L213
+   */
+  public static CelebornConf setMemoryConfs(
+      SparkConf sparkConf, CelebornConf celebornConf, int cores, MemoryMode 
memoryMode) {
+    try {
+      if (!celebornConf.clientPushSortCalculateMaxMemoryBytes()) {
+        return celebornConf;
+      }
+
+      // set max task memory conf based on Spark conf
+      if (celebornConf.clientPushSortMaxMemoryBytes() <= 0L) {
+        double memoryStorageFraction =
+            sparkConf.getDouble(package$.MODULE$.MEMORY_FRACTION().key(), 0.6);

Review Comment:
   Maybe you can use the string value directly?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to