dmvk commented on code in PR #21981:
URL: https://github.com/apache/flink/pull/21981#discussion_r1112815613


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/allocator/SlotSharingSlotAllocator.java:
##########
@@ -121,16 +133,13 @@ public Optional<VertexParallelismWithSlotSharing> 
determineParallelism(
                             slotSharingGroupParallelism.get(
                                     slotSharingGroup.getSlotSharingGroupId()));
 
-            final Iterable<ExecutionSlotSharingGroup> 
sharedSlotToVertexAssignment =
+            final List<ExecutionSlotSharingGroup> sharedSlotToVertexAssignment 
=
                     createExecutionSlotSharingGroups(vertexParallelism);
 
-            for (ExecutionSlotSharingGroup executionSlotSharingGroup :
-                    sharedSlotToVertexAssignment) {
-                final SlotInfo slotInfo = slotIterator.next();
-
-                assignments.add(
-                        new 
ExecutionSlotSharingGroupAndSlot(executionSlotSharingGroup, slotInfo));
-            }
+            SlotAssigner.AssignmentResult result =
+                    slotAssigner.assignSlots(freeSlots, 
sharedSlotToVertexAssignment);
+            assignments.addAll(result.assignments);
+            freeSlots = result.remainingSlots;

Review Comment:
   🤔 Is there a reason to run this within the loop at all? Can we simply move 
this to after the loop?



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