Interface SlotAllocator
- All Known Implementing Classes:
SlotSharingSlotAllocator
public interface SlotAllocator
Component for calculating the slot requirements and mapping of vertices to slots.
-
Method Summary
Modifier and TypeMethodDescriptionCalculates the total resources required for scheduling the given vertices.determineParallelism(JobInformation jobInformation, Collection<? extends SlotInfo> slots) 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 asdetermineParallelism(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
-
calculateRequiredSlots
Calculates the total resources required for scheduling the given vertices.- Parameters:
vertices- vertices to schedule- Returns:
- required resources
-
determineParallelism
Optional<VertexParallelism> determineParallelism(JobInformation jobInformation, Collection<? extends SlotInfo> slots) Determines 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 whatcalculateRequiredSlots(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
tryReserveResources(JobSchedulingPlan).- Parameters:
jobInformation- information about the job graphslots- 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
Optional<JobSchedulingPlan> determineParallelismAndCalculateAssignment(JobInformation jobInformation, Collection<? extends SlotInfo> slots, JobAllocationsInformation jobAllocationsInformation) Same asdetermineParallelism(JobInformation, Collection)but additionally determine assignment of slots to execution slot sharing groups. -
tryReserveResources
Reserves 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().- 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()
-