Class DefaultFreeSlotTracker
- java.lang.Object
-
- org.apache.flink.runtime.jobmaster.slotpool.DefaultFreeSlotTracker
-
- All Implemented Interfaces:
FreeSlotTracker
public class DefaultFreeSlotTracker extends Object implements FreeSlotTracker
Default implements ofFreeSlotTracker.
-
-
Constructor Summary
Constructors Constructor Description DefaultFreeSlotTracker(Set<AllocationID> freeSlots, Function<AllocationID,PhysicalSlot> physicalSlotLookup, Function<AllocationID,AllocatedSlotPool.FreeSlotInfo> freeSlotInfoLookup, Function<ResourceID,Double> taskExecutorUtilizationLookup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultFreeSlotTrackercreateNewFreeSlotTrackerWithoutBlockedSlots(Set<AllocationID> blockedSlots)Create a new free slot tracker without blocked slots.Set<AllocationID>getAvailableSlots()Get allocation id of all available slots.Collection<PhysicalSlot>getFreeSlotsInformation()Returns a list ofPhysicalSlotobjects about all slots that are currently available in the slot pool.Collection<AllocatedSlotPool.FreeSlotInfo>getFreeSlotsWithIdleSinceInformation()Returns a list ofAllocatedSlotPool.FreeSlotInfoobjects about all slots with slot idle since that are currently available in the slot pool.SlotInfogetSlotInfo(AllocationID allocationId)Get slot info by allocation id, this slot must exist.doublegetTaskExecutorUtilization(SlotInfo slotInfo)Get task executor utilization of this slot.voidreserveSlot(AllocationID allocationId)Reserve free slot when it is used.
-
-
-
Constructor Detail
-
DefaultFreeSlotTracker
public DefaultFreeSlotTracker(Set<AllocationID> freeSlots, Function<AllocationID,PhysicalSlot> physicalSlotLookup, Function<AllocationID,AllocatedSlotPool.FreeSlotInfo> freeSlotInfoLookup, Function<ResourceID,Double> taskExecutorUtilizationLookup)
-
-
Method Detail
-
getAvailableSlots
public Set<AllocationID> getAvailableSlots()
Description copied from interface:FreeSlotTrackerGet allocation id of all available slots.- Specified by:
getAvailableSlotsin interfaceFreeSlotTracker- Returns:
- allocation id of available slots
-
getSlotInfo
public SlotInfo getSlotInfo(AllocationID allocationId)
Description copied from interface:FreeSlotTrackerGet slot info by allocation id, this slot must exist.- Specified by:
getSlotInfoin interfaceFreeSlotTracker- Parameters:
allocationId- to get SlotInfo- Returns:
- slot info for the allocation id
-
getFreeSlotsWithIdleSinceInformation
public Collection<AllocatedSlotPool.FreeSlotInfo> getFreeSlotsWithIdleSinceInformation()
Description copied from interface:FreeSlotTrackerReturns a list ofAllocatedSlotPool.FreeSlotInfoobjects about all slots with slot idle since that are currently available in the slot pool.- Specified by:
getFreeSlotsWithIdleSinceInformationin interfaceFreeSlotTracker- Returns:
- a list of
AllocatedSlotPool.FreeSlotInfoobjects about all slots with slot idle since that are currently available in the slot pool.
-
getFreeSlotsInformation
public Collection<PhysicalSlot> getFreeSlotsInformation()
Description copied from interface:FreeSlotTrackerReturns a list ofPhysicalSlotobjects about all slots that are currently available in the slot pool.- Specified by:
getFreeSlotsInformationin interfaceFreeSlotTracker- Returns:
- a list of
PhysicalSlotobjects about all slots that are currently available in the slot pool.
-
getTaskExecutorUtilization
public double getTaskExecutorUtilization(SlotInfo slotInfo)
Description copied from interface:FreeSlotTrackerGet task executor utilization of this slot.- Specified by:
getTaskExecutorUtilizationin interfaceFreeSlotTracker- Parameters:
slotInfo- to get task executor utilization- Returns:
- task executor utilization of this slot
-
reserveSlot
public void reserveSlot(AllocationID allocationId)
Description copied from interface:FreeSlotTrackerReserve free slot when it is used.- Specified by:
reserveSlotin interfaceFreeSlotTracker- Parameters:
allocationId- to reserve
-
createNewFreeSlotTrackerWithoutBlockedSlots
public DefaultFreeSlotTracker createNewFreeSlotTrackerWithoutBlockedSlots(Set<AllocationID> blockedSlots)
Description copied from interface:FreeSlotTrackerCreate a new free slot tracker without blocked slots.- Specified by:
createNewFreeSlotTrackerWithoutBlockedSlotsin interfaceFreeSlotTracker- Parameters:
blockedSlots- slots that should not be used- Returns:
- the new free slot tracker
-
-