Interface AllocatedSlotPool

All Known Implementing Classes:
DefaultAllocatedSlotPool

public interface AllocatedSlotPool
The slot pool is responsible for maintaining a set of AllocatedSlots.
  • Method Details

    • addSlots

      void addSlots(Collection<org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot> slots, long currentTime)
      Adds the given collection of slots to the slot pool.
      Parameters:
      slots - slots to add to the slot pool
      currentTime - currentTime when the slots have been added to the slot pool
      Throws:
      IllegalStateException - if the slot pool already contains a to be added slot
    • removeSlot

      Optional<org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot> removeSlot(AllocationID allocationId)
      Removes the slot with the given allocationId from the slot pool.
      Parameters:
      allocationId - allocationId identifying the slot to remove from the slot pool
      Returns:
      the removed slot if there was a slot with the given allocationId; otherwise Optional.empty()
    • removeSlots

      Removes all slots belonging to the owning TaskExecutor identified by owner.
      Parameters:
      owner - owner identifies the TaskExecutor whose slots shall be removed
      Returns:
      the collection of removed slots and for each slot whether it was currently free
    • containsSlots

      boolean containsSlots(ResourceID owner)
      Checks whether the slot pool contains at least one slot belonging to the specified owner.
      Parameters:
      owner - owner for which to check whether the slot pool contains slots
      Returns:
      true if the slot pool contains a slot from the given owner; otherwise false
    • containsSlot

      boolean containsSlot(AllocationID allocationId)
      Checks whether the slot pool contains a slot with the given allocationId.
      Parameters:
      allocationId - allocationId identifying the slot for which to check whether it is contained
      Returns:
      true if the slot pool contains the slot with the given allocationId; otherwise false
    • containsFreeSlot

      boolean containsFreeSlot(AllocationID allocationId)
      Checks whether the slot pool contains a slot with the given AllocationID and if it is free.
      Parameters:
      allocationId - allocationId specifies the slot to check for
      Returns:
      true if the slot pool contains a free slot registered under the given allocation id; otherwise false
    • reserveFreeSlot

      org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot reserveFreeSlot(AllocationID allocationId)
      Reserves the free slot specified by the given allocationId.
      Parameters:
      allocationId - allocationId identifying the free slot to reserve
      Returns:
      the AllocatedSlot which has been reserved
      Throws:
      IllegalStateException - if there is no free slot with the given allocationId
    • freeReservedSlot

      Optional<org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot> freeReservedSlot(AllocationID allocationId, long currentTime)
      Frees the reserved slot, adding it back into the set of free slots.
      Parameters:
      allocationId - identifying the reserved slot to freed
      currentTime - currentTime when the slot has been freed
      Returns:
      the freed AllocatedSlot if there was an allocated with the given allocationId; otherwise Optional.empty().
    • getSlotInformation

      Optional<SlotInfo> getSlotInformation(AllocationID allocationID)
      Returns slot information specified by the given allocationId.
      Returns:
      the slot information if there was a slot with the given allocationId; otherwise Optional.empty()
    • getFreeSlotTracker

      FreeSlotTracker getFreeSlotTracker()
      Returns information about all currently free slots.
      Returns:
      free slot information
    • getAllSlotsInformation

      Collection<? extends SlotInfo> getAllSlotsInformation()
      Returns information about all slots in this pool.
      Returns:
      collection of all slot information