Class SlotSharingSlotAllocator
java.lang.Object
org.apache.flink.runtime.scheduler.adaptive.allocator.SlotSharingSlotAllocator
- All Implemented Interfaces:
SlotAllocator
SlotAllocator implementation that supports slot sharing.-
Method Summary
Modifier and TypeMethodDescriptionCalculates the total resources required for scheduling the given vertices.static SlotSharingSlotAllocatorcreateSlotSharingSlotAllocator(ReserveSlotFunction reserveSlot, FreeSlotFunction freeSlotFunction, IsSlotAvailableAndFreeFunction isSlotAvailableAndFreeFunction, boolean localRecoveryEnabled) determineParallelism(JobInformation jobInformation, Collection<? extends SlotInfo> freeSlots) Determines the parallelism at which the vertices could be scheduled given the collection of slots.determineParallelismAndCalculateAssignment(JobInformation jobInformation, Collection<? extends SlotInfo> slots, JobAllocationsInformation jobAllocationsInformation) Same asSlotAllocator.determineParallelism(JobInformation, Collection)but additionally determine assignment of slots to execution slot sharing groups.tryReserveResources(JobSchedulingPlan jobSchedulingPlan) Reserves slots according to the given assignment if possible.
-
Method Details
-
createSlotSharingSlotAllocator
public static SlotSharingSlotAllocator createSlotSharingSlotAllocator(ReserveSlotFunction reserveSlot, FreeSlotFunction freeSlotFunction, IsSlotAvailableAndFreeFunction isSlotAvailableAndFreeFunction, boolean localRecoveryEnabled) -
calculateRequiredSlots
Description copied from interface:SlotAllocatorCalculates the total resources required for scheduling the given vertices.- Specified by:
calculateRequiredSlotsin interfaceSlotAllocator- Parameters:
vertices- vertices to schedule- Returns:
- required resources
-
determineParallelism
public Optional<VertexParallelism> determineParallelism(JobInformation jobInformation, Collection<? extends SlotInfo> freeSlots) Description copied from interface:SlotAllocatorDetermines the parallelism at which the vertices could be scheduled given the collection of slots. This method may be called with any number of slots providing any amount of resources, irrespective of whatSlotAllocator.calculateRequiredSlots(Iterable)returned.If a
VertexParallelismis returned then it covers all vertices contained in the given job information.Implementations of this method must be side-effect free. There is no guarantee that the result of this method is ever passed to
SlotAllocator.tryReserveResources(JobSchedulingPlan).- Specified by:
determineParallelismin interfaceSlotAllocator- Parameters:
jobInformation- information about the job graphfreeSlots- slots to consider for determining the parallelism- Returns:
- potential parallelism for all vertices and implementation-specific information for how the vertices could be assigned to slots, if all vertices could be run with the given slots
-
determineParallelismAndCalculateAssignment
public Optional<JobSchedulingPlan> determineParallelismAndCalculateAssignment(JobInformation jobInformation, Collection<? extends SlotInfo> slots, JobAllocationsInformation jobAllocationsInformation) Description copied from interface:SlotAllocatorSame asSlotAllocator.determineParallelism(JobInformation, Collection)but additionally determine assignment of slots to execution slot sharing groups.- Specified by:
determineParallelismAndCalculateAssignmentin interfaceSlotAllocator
-
tryReserveResources
Description copied from interface:SlotAllocatorReserves slots according to the given assignment if possible. If the underlying set of resources has changed and the reservation with respect to vertexParallelism is no longer possible, then this method returnsOptional.empty().- Specified by:
tryReserveResourcesin interfaceSlotAllocator- Parameters:
jobSchedulingPlan- information on how slots should be assigned to the slots- Returns:
- Set of reserved slots if the reservation was successful; otherwise
Optional.empty()
-