zhuzhurk commented on a change in pull request #13284:
URL: https://github.com/apache/flink/pull/13284#discussion_r483957549



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/ExecutionSlotAllocatorFactory.java
##########
@@ -19,11 +19,39 @@
 
 package org.apache.flink.runtime.scheduler;
 
+import org.apache.flink.runtime.clusterframework.types.AllocationID;
+import org.apache.flink.runtime.clusterframework.types.ResourceProfile;
+import org.apache.flink.runtime.jobmanager.scheduler.CoLocationGroupDesc;
+import org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup;
+import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID;
+import org.apache.flink.runtime.scheduler.strategy.SchedulingTopology;
+
+import java.util.Set;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
 /**
  * Interface for {@link ExecutionSlotAllocator} factories.
  */
+@FunctionalInterface
 public interface ExecutionSlotAllocatorFactory {
 
-       ExecutionSlotAllocator createInstance(PreferredLocationsRetriever 
preferredLocationsRetriever);
-
+       /**
+        * Instantiates the {@link ExecutionSlotAllocator}.
+        *
+        * @param preferredLocationsRetriever to retrieve preferred locations 
for each execution
+        * @param resourceProfileRetriever to retrieve required {@link 
ResourceProfile} for each execution
+        * @param priorAllocationIdRetriever to retrieve prior {@link 
AllocationID} for each execution
+        * @param topology scheduling topology of the job
+        * @param logicalSlotSharingGroupSupplier to supply all slot sharing 
groups in the job
+        * @param coLocationGroupSupplier to supply all co-location groups in 
the job
+        * @return The instantiated slot allocator
+        */
+       ExecutionSlotAllocator createInstance(
+               PreferredLocationsRetriever preferredLocationsRetriever,
+               Function<ExecutionVertexID, ResourceProfile> 
resourceProfileRetriever,
+               Function<ExecutionVertexID, AllocationID> 
priorAllocationIdRetriever,
+               SchedulingTopology topology,
+               Supplier<Set<SlotSharingGroup>> logicalSlotSharingGroupSupplier,
+               Supplier<Set<CoLocationGroupDesc>> coLocationGroupSupplier);

Review comment:
       One example is that if a user uses eager scheduling, 
`getSlotSharingGroups()` and `getCoLocationGroupDescriptors()` will not be 
invoked if we use supplier here because they will not be used. 




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

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


Reply via email to