Class BlocklistDeclarativeSlotPool
- java.lang.Object
-
- org.apache.flink.runtime.jobmaster.slotpool.DefaultDeclarativeSlotPool
-
- org.apache.flink.runtime.jobmaster.slotpool.BlocklistDeclarativeSlotPool
-
- All Implemented Interfaces:
DeclarativeSlotPool
public class BlocklistDeclarativeSlotPool extends DefaultDeclarativeSlotPool
ADeclarativeSlotPool
implementation that supports blocklist. This implementation will avoid allocating slots that located on blocked nodes. The core idea is to keep the slot pool in such a state: there is no slot in slot pool that is free (no task assigned) and located on blocked nodes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.jobmaster.slotpool.DeclarativeSlotPool
DeclarativeSlotPool.NewSlotsListener, DeclarativeSlotPool.NoOpNewSlotsListener
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.jobmaster.slotpool.DefaultDeclarativeSlotPool
log, slotPool
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceCounter
freeReservedSlot(AllocationID allocationId, Throwable cause, long currentTime)
Frees the reserved slot identified by the given allocationId.Collection<SlotOffer>
offerSlots(Collection<? extends SlotOffer> offers, TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, long currentTime)
Offers slots to this slot pool.Collection<SlotOffer>
registerSlots(Collection<? extends SlotOffer> slots, TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, long currentTime)
Registers the given set of slots at the slot pool.-
Methods inherited from class org.apache.flink.runtime.jobmaster.slotpool.DefaultDeclarativeSlotPool
containsFreeSlot, containsSlots, decreaseResourceRequirementsBy, getAllSlotsInformation, getFreeSlotTracker, getResourceRequirements, increaseResourceRequirementsBy, registerNewSlotsListener, releaseIdleSlots, releaseSlot, releaseSlots, reserveFreeSlot, setResourceRequirements
-
-
-
-
Method Detail
-
offerSlots
public Collection<SlotOffer> offerSlots(Collection<? extends SlotOffer> offers, TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, long currentTime)
Description copied from interface:DeclarativeSlotPool
Offers slots to this slot pool. The slot pool is free to accept as many slots as it needs.- Specified by:
offerSlots
in interfaceDeclarativeSlotPool
- Overrides:
offerSlots
in classDefaultDeclarativeSlotPool
- Parameters:
offers
- offers containing the list of slots offered to this slot pooltaskManagerLocation
- taskManagerLocation is the location of the offering TaskExecutortaskManagerGateway
- taskManagerGateway is the gateway to talk to the offering TaskExecutorcurrentTime
- currentTime is the time the slots are being offered- Returns:
- collection of accepted slots; the other slot offers are implicitly rejected
-
registerSlots
public Collection<SlotOffer> registerSlots(Collection<? extends SlotOffer> slots, TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, long currentTime)
Description copied from interface:DeclarativeSlotPool
Registers the given set of slots at the slot pool. The slot pool will try to accept all slots unless the slot is unavailable (for example, the TaskManger is blocked).The difference from
DeclarativeSlotPool.offerSlots(java.util.Collection<? extends org.apache.flink.runtime.taskexecutor.slot.SlotOffer>, org.apache.flink.runtime.taskmanager.TaskManagerLocation, org.apache.flink.runtime.jobmanager.slots.TaskManagerGateway, long)
is that this method allows accepting slots which exceed the currently required, but theDeclarativeSlotPool.offerSlots(java.util.Collection<? extends org.apache.flink.runtime.taskexecutor.slot.SlotOffer>, org.apache.flink.runtime.taskmanager.TaskManagerLocation, org.apache.flink.runtime.jobmanager.slots.TaskManagerGateway, long)
only accepts those slots that are currently required.- Specified by:
registerSlots
in interfaceDeclarativeSlotPool
- Overrides:
registerSlots
in classDefaultDeclarativeSlotPool
- Parameters:
slots
- slots to registertaskManagerLocation
- taskManagerLocation is the location of the offering TaskExecutortaskManagerGateway
- taskManagerGateway is the gateway to talk to the offering TaskExecutorcurrentTime
- currentTime is the time the slots are being offered- Returns:
- the successfully registered slots; the other slot offers are implicitly rejected
-
freeReservedSlot
public ResourceCounter freeReservedSlot(AllocationID allocationId, @Nullable Throwable cause, long currentTime)
Description copied from interface:DeclarativeSlotPool
Frees the reserved slot identified by the given allocationId. If no slot with allocationId exists, then the call is ignored.Whether the freed slot is returned to the owning TaskExecutor is implementation dependent.
- Specified by:
freeReservedSlot
in interfaceDeclarativeSlotPool
- Overrides:
freeReservedSlot
in classDefaultDeclarativeSlotPool
- Parameters:
allocationId
- allocationId identifying the slot to releasecause
- cause for releasing the slot; can benull
currentTime
- currentTime when the slot was released- Returns:
- the resource requirements that the slot was fulfilling
-
-