You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "waitinfuture (via GitHub)" <gi...@apache.org> on 2023/05/15 03:22:22 UTC

[GitHub] [incubator-celeborn] waitinfuture commented on a diff in pull request #1370: [CELEBORN-446] Support rack aware during assign slots for ROUNDROBIN

waitinfuture commented on code in PR #1370:
URL: https://github.com/apache/incubator-celeborn/pull/1370#discussion_r1193286191


##########
master/src/main/java/org/apache/celeborn/service/deploy/master/SlotsAllocator.java:
##########
@@ -238,6 +253,23 @@ private static List<Integer> roundRobin(
     return partitionIdList;
   }
 
+  private static boolean haveUsableSlots(
+      Map<WorkerInfo, List<UsableDiskInfo>> restrictions, List<WorkerInfo> workers, int index) {
+    return restrictions.get(workers.get(index)).stream().mapToLong(i -> i.usableSlots).sum() > 0;
+  }
+
+  private static boolean satisfyRackAware(
+      CelebornRackResolver rackResolver,
+      List<WorkerInfo> workers,
+      int masterIndex,
+      int nextSlaveInd) {
+    return rackResolver == null
+        || !rackResolver.enabledRackAware()
+        || rackResolver.getDistance(

Review Comment:
   I think we can just check if the two nodes have the same parent, like ```NetworkTopology.isOnSameRack``` in hadoop 3.2.1
   ```
     public boolean isOnSameRack( Node node1,  Node node2) {
       if (node1 == null || node2 == null) {
         return false;
       }
         
       netlock.readLock().lock();
       try {
         return isSameParents(node1, node2);
       } finally {
         netlock.readLock().unlock();
       }
     }
   ```



##########
common/src/main/scala/org/apache/celeborn/common/network/CelebornRackResolver.scala:
##########
@@ -46,8 +48,8 @@ class CelebornRackResolver(celebornConf: CelebornConf) extends Logging {
     }
   }
 
-  def resolve(hostName: String): String = {
-    coreResolve(Seq(hostName)).head.getNetworkLocation
+  def resolve(hostName: String): Node = {

Review Comment:
   It's better to cache the hostName -> Node in this class to avoid resolve every time.



##########
master/src/main/java/org/apache/celeborn/service/deploy/master/SlotsAllocator.java:
##########
@@ -144,9 +154,11 @@ static class UsableDiskInfo {
             partitionIds,
             new ArrayList<>(restriction.keySet()),
             restriction,
-            shouldReplicate);
+            shouldReplicate,
+            rackResolver);
     if (!remainPartitions.isEmpty()) {
-      roundRobin(slots, remainPartitions, new ArrayList<>(workers), null, shouldReplicate);
+      roundRobin(

Review Comment:
   This call here does't guarantee slots will be allocated if rackAware is enabled. We should do as ```offerSlotsRoundRobin``` does, or we just pass null as rackResolver, and theses two places should be consistent.



-- 
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@celeborn.apache.org

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