Class DefaultFreeSlotInfoTracker
- java.lang.Object
-
- org.apache.flink.runtime.jobmaster.slotpool.DefaultFreeSlotInfoTracker
-
- All Implemented Interfaces:
FreeSlotInfoTracker
public class DefaultFreeSlotInfoTracker extends Object implements FreeSlotInfoTracker
Default implements ofFreeSlotInfoTracker.
-
-
Constructor Summary
Constructors Constructor Description DefaultFreeSlotInfoTracker(Set<AllocationID> freeSlots, java.util.function.Function<AllocationID,SlotInfo> slotInfoLookup, java.util.function.Function<AllocationID,AllocatedSlotPool.FreeSlotInfo> freeSlotInfoLookup, java.util.function.Function<ResourceID,Double> taskExecutorUtilizationLookup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultFreeSlotInfoTrackercreateNewFreeSlotInfoTrackerWithoutBlockedSlots(Set<AllocationID> blockedSlots)Create a new free slot tracker without blocked slots.Set<AllocationID>getAvailableSlots()Get allocation id of all available slots.Collection<SlotInfo>getFreeSlotsInformation()Returns a list ofSlotInfoobjects 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
-
DefaultFreeSlotInfoTracker
public DefaultFreeSlotInfoTracker(Set<AllocationID> freeSlots, java.util.function.Function<AllocationID,SlotInfo> slotInfoLookup, java.util.function.Function<AllocationID,AllocatedSlotPool.FreeSlotInfo> freeSlotInfoLookup, java.util.function.Function<ResourceID,Double> taskExecutorUtilizationLookup)
-
-
Method Detail
-
getAvailableSlots
public Set<AllocationID> getAvailableSlots()
Description copied from interface:FreeSlotInfoTrackerGet allocation id of all available slots.- Specified by:
getAvailableSlotsin interfaceFreeSlotInfoTracker- Returns:
- allocation id of available slots
-
getSlotInfo
public SlotInfo getSlotInfo(AllocationID allocationId)
Description copied from interface:FreeSlotInfoTrackerGet slot info by allocation id, this slot must exist.- Specified by:
getSlotInfoin interfaceFreeSlotInfoTracker- Parameters:
allocationId- to get SlotInfo- Returns:
- slot info for the allocation id
-
getFreeSlotsWithIdleSinceInformation
public Collection<AllocatedSlotPool.FreeSlotInfo> getFreeSlotsWithIdleSinceInformation()
Description copied from interface:FreeSlotInfoTrackerReturns a list ofAllocatedSlotPool.FreeSlotInfoobjects about all slots with slot idle since that are currently available in the slot pool.- Specified by:
getFreeSlotsWithIdleSinceInformationin interfaceFreeSlotInfoTracker- Returns:
- a list of
AllocatedSlotPool.FreeSlotInfoobjects about all slots with slot idle since that are currently available in the slot pool.
-
getFreeSlotsInformation
public Collection<SlotInfo> getFreeSlotsInformation()
Description copied from interface:FreeSlotInfoTrackerReturns a list ofSlotInfoobjects about all slots that are currently available in the slot pool.- Specified by:
getFreeSlotsInformationin interfaceFreeSlotInfoTracker- Returns:
- a list of
SlotInfoobjects about all slots that are currently available in the slot pool.
-
getTaskExecutorUtilization
public double getTaskExecutorUtilization(SlotInfo slotInfo)
Description copied from interface:FreeSlotInfoTrackerGet task executor utilization of this slot.- Specified by:
getTaskExecutorUtilizationin interfaceFreeSlotInfoTracker- Parameters:
slotInfo- to get task executor utilization- Returns:
- task executor utilization of this slot
-
reserveSlot
public void reserveSlot(AllocationID allocationId)
Description copied from interface:FreeSlotInfoTrackerReserve free slot when it is used.- Specified by:
reserveSlotin interfaceFreeSlotInfoTracker- Parameters:
allocationId- to reserve
-
createNewFreeSlotInfoTrackerWithoutBlockedSlots
public DefaultFreeSlotInfoTracker createNewFreeSlotInfoTrackerWithoutBlockedSlots(Set<AllocationID> blockedSlots)
Description copied from interface:FreeSlotInfoTrackerCreate a new free slot tracker without blocked slots.- Specified by:
createNewFreeSlotInfoTrackerWithoutBlockedSlotsin interfaceFreeSlotInfoTracker- Parameters:
blockedSlots- slots that should not be used- Returns:
- the new free slot tracker
-
-