Class DefaultAllocatedSlotPool
java.lang.Object
org.apache.flink.runtime.jobmaster.slotpool.DefaultAllocatedSlotPool
- All Implemented Interfaces:
AllocatedSlotPool
Default
AllocatedSlotPool implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlotPool
AllocatedSlotPool.AllocatedSlotsAndReservationStatus, AllocatedSlotPool.FreeSlotInfo -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSlots(Collection<org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot> slots, long currentTime) Adds the given collection of slots to the slot pool.booleancontainsFreeSlot(AllocationID allocationId) Checks whether the slot pool contains a slot with the givenAllocationIDand if it is free.booleancontainsSlot(AllocationID allocationId) Checks whether the slot pool contains a slot with the given allocationId.booleancontainsSlots(ResourceID owner) Checks whether the slot pool contains at least one slot belonging to the specified owner.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.Collection<? extends SlotInfo>Returns information about all slots in this pool.Returns information about all currently free slots.getSlotInformation(AllocationID allocationID) Returns slot information specified by the given allocationId.Optional<org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot>removeSlot(AllocationID allocationId) Removes the slot with the given allocationId from the slot pool.removeSlots(ResourceID owner) Removes all slots belonging to the owning TaskExecutor identified by owner.org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlotreserveFreeSlot(AllocationID allocationId) Reserves the free slot specified by the given allocationId.
-
Constructor Details
-
DefaultAllocatedSlotPool
public DefaultAllocatedSlotPool()
-
-
Method Details
-
addSlots
public void addSlots(Collection<org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot> slots, long currentTime) Description copied from interface:AllocatedSlotPoolAdds the given collection of slots to the slot pool.- Specified by:
addSlotsin interfaceAllocatedSlotPool- Parameters:
slots- slots to add to the slot poolcurrentTime- currentTime when the slots have been added to the slot pool
-
removeSlot
public Optional<org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot> removeSlot(AllocationID allocationId) Description copied from interface:AllocatedSlotPoolRemoves the slot with the given allocationId from the slot pool.- Specified by:
removeSlotin interfaceAllocatedSlotPool- 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
Description copied from interface:AllocatedSlotPoolRemoves all slots belonging to the owning TaskExecutor identified by owner.- Specified by:
removeSlotsin interfaceAllocatedSlotPool- 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
Description copied from interface:AllocatedSlotPoolChecks whether the slot pool contains at least one slot belonging to the specified owner.- Specified by:
containsSlotsin interfaceAllocatedSlotPool- Parameters:
owner- owner for which to check whether the slot pool contains slots- Returns:
trueif the slot pool contains a slot from the given owner; otherwisefalse
-
containsSlot
Description copied from interface:AllocatedSlotPoolChecks whether the slot pool contains a slot with the given allocationId.- Specified by:
containsSlotin interfaceAllocatedSlotPool- Parameters:
allocationId- allocationId identifying the slot for which to check whether it is contained- Returns:
trueif the slot pool contains the slot with the given allocationId; otherwisefalse
-
containsFreeSlot
Description copied from interface:AllocatedSlotPoolChecks whether the slot pool contains a slot with the givenAllocationIDand if it is free.- Specified by:
containsFreeSlotin interfaceAllocatedSlotPool- Parameters:
allocationId- allocationId specifies the slot to check for- Returns:
trueif the slot pool contains a free slot registered under the given allocation id; otherwisefalse
-
reserveFreeSlot
public org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot reserveFreeSlot(AllocationID allocationId) Description copied from interface:AllocatedSlotPoolReserves the free slot specified by the given allocationId.- Specified by:
reserveFreeSlotin interfaceAllocatedSlotPool- Parameters:
allocationId- allocationId identifying the free slot to reserve- Returns:
- the
AllocatedSlotwhich has been reserved
-
freeReservedSlot
public Optional<org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlot> freeReservedSlot(AllocationID allocationId, long currentTime) Description copied from interface:AllocatedSlotPoolFrees the reserved slot, adding it back into the set of free slots.- Specified by:
freeReservedSlotin interfaceAllocatedSlotPool- Parameters:
allocationId- identifying the reserved slot to freedcurrentTime- currentTime when the slot has been freed- Returns:
- the freed
AllocatedSlotif there was an allocated with the given allocationId; otherwiseOptional.empty().
-
getSlotInformation
Description copied from interface:AllocatedSlotPoolReturns slot information specified by the given allocationId.- Specified by:
getSlotInformationin interfaceAllocatedSlotPool- Returns:
- the slot information if there was a slot with the given allocationId; otherwise
Optional.empty()
-
getFreeSlotTracker
Description copied from interface:AllocatedSlotPoolReturns information about all currently free slots.- Specified by:
getFreeSlotTrackerin interfaceAllocatedSlotPool- Returns:
- free slot information
-
getAllSlotsInformation
Description copied from interface:AllocatedSlotPoolReturns information about all slots in this pool.- Specified by:
getAllSlotsInformationin interfaceAllocatedSlotPool- Returns:
- collection of all slot information
-