All Known Implementing Classes:
SlotSharingSlotAllocator

public interface SlotAllocator
Component for calculating the slot requirements and mapping of vertices to slots.
  • Method Details

    • calculateRequiredSlots

      ResourceCounter calculateRequiredSlots(Iterable<JobInformation.VertexInformation> vertices)
      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 what calculateRequiredSlots(Iterable) returned.

      If a VertexParallelism is 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 graph
      slots - 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 as determineParallelism(JobInformation, Collection) but additionally determine assignment of slots to execution slot sharing groups.
    • tryReserveResources

      Optional<ReservedSlots> tryReserveResources(JobSchedulingPlan jobSchedulingPlan)
      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 returns Optional.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()