This is an automated email from the ASF dual-hosted git repository.

rexxiong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 64a4f7274 [CELEBORN-554][Tuning]  Improve For LM to avoid 
reserve/commit empty worker resources (#1459)
64a4f7274 is described below

commit 64a4f7274cd7f2f56208cbb34debf377a7951da8
Author: Shuang <[email protected]>
AuthorDate: Wed Apr 26 18:04:50 2023 +0800

    [CELEBORN-554][Tuning]  Improve For LM to avoid reserve/commit empty worker 
resources (#1459)
---
 .../src/main/scala/org/apache/celeborn/client/LifecycleManager.scala | 5 +++--
 .../main/scala/org/apache/celeborn/client/commit/CommitHandler.scala | 5 +++--
 .../apache/celeborn/common/meta/ShufflePartitionLocationInfo.scala   | 4 ++++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git 
a/client/src/main/scala/org/apache/celeborn/client/LifecycleManager.scala 
b/client/src/main/scala/org/apache/celeborn/client/LifecycleManager.scala
index 6f18356e6..7fcc98539 100644
--- a/client/src/main/scala/org/apache/celeborn/client/LifecycleManager.scala
+++ b/client/src/main/scala/org/apache/celeborn/client/LifecycleManager.scala
@@ -662,8 +662,9 @@ class LifecycleManager(appId: String, val conf: 
CelebornConf) extends RpcEndpoin
       slots: WorkerResource): util.List[WorkerInfo] = {
     val reserveSlotFailedWorkers = new ShuffleFailedWorkers()
     val failureInfos = new util.concurrent.CopyOnWriteArrayList[String]()
-    val parallelism = Math.min(Math.max(1, slots.size()), 
conf.rpcMaxParallelism)
-    ThreadUtils.parmap(slots.asScala.to, "ReserveSlot", parallelism) {
+    val workerPartitionLocations = slots.asScala.filter(p => !p._2._1.isEmpty 
|| !p._2._2.isEmpty)
+    val parallelism = Math.min(Math.max(1, workerPartitionLocations.size), 
conf.rpcMaxParallelism)
+    ThreadUtils.parmap(workerPartitionLocations.to, "ReserveSlot", 
parallelism) {
       case (workerInfo, (masterLocations, slaveLocations)) =>
         val res = requestReserveSlots(
           workerInfo.endpoint,
diff --git 
a/client/src/main/scala/org/apache/celeborn/client/commit/CommitHandler.scala 
b/client/src/main/scala/org/apache/celeborn/client/commit/CommitHandler.scala
index 7bb9bd05c..af71e472b 100644
--- 
a/client/src/main/scala/org/apache/celeborn/client/commit/CommitHandler.scala
+++ 
b/client/src/main/scala/org/apache/celeborn/client/commit/CommitHandler.scala
@@ -193,9 +193,10 @@ abstract class CommitHandler(
     }
 
     val commitFileStartTime = System.nanoTime()
-    val parallelism = Math.min(allocatedWorkers.size(), conf.rpcMaxParallelism)
+    val workerPartitionLocations = 
allocatedWorkers.asScala.filter(!_._2.isEmpty)
+    val parallelism = Math.min(workerPartitionLocations.size, 
conf.rpcMaxParallelism)
     ThreadUtils.parmap(
-      allocatedWorkers.asScala.to,
+      workerPartitionLocations.to,
       "CommitFiles",
       parallelism) { case (worker, partitionLocationInfo) =>
       val masterParts =
diff --git 
a/common/src/main/scala/org/apache/celeborn/common/meta/ShufflePartitionLocationInfo.scala
 
b/common/src/main/scala/org/apache/celeborn/common/meta/ShufflePartitionLocationInfo.scala
index 9b92e0705..1a4f6d2b4 100644
--- 
a/common/src/main/scala/org/apache/celeborn/common/meta/ShufflePartitionLocationInfo.scala
+++ 
b/common/src/main/scala/org/apache/celeborn/common/meta/ShufflePartitionLocationInfo.scala
@@ -48,6 +48,10 @@ class ShufflePartitionLocationInfo {
     getPartitions(slavePartitionLocations, partitionIdOpt)
   }
 
+  def isEmpty(): Boolean = {
+    masterPartitionLocations.isEmpty && slavePartitionLocations.isEmpty
+  }
+
   def containsPartition(partitionId: Int): Boolean = {
     masterPartitionLocations.containsKey(partitionId) ||
     slavePartitionLocations.containsKey(partitionId)

Reply via email to