Interface SlotPool
- All Superinterfaces:
AllocatedSlotActions,AutoCloseable
- All Known Implementing Classes:
DeclarativeSlotPoolBridge
The Interface of a slot pool that manages slots.
-
Method Summary
Modifier and TypeMethodDescriptionallocateAvailableSlot(SlotRequestId slotRequestId, AllocationID allocationID, ResourceProfile requirementProfile) Allocates the available slot with the given allocation id under the given request id for the given requirement profile.voidclose()voidconnectToResourceManager(ResourceManagerGateway resourceManagerGateway) Connects the SlotPool to the given ResourceManager.createAllocatedSlotReport(ResourceID taskManagerId) Create report about the allocated slots belonging to the specified task manager.voidDisables batch slot request timeout check.voidDisconnects the slot pool from its current Resource Manager.Returns a list ofSlotInfoobjects about all slots that are currently allocated in the slot pool.Returns all free slot tracker.offerSlots(TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, Collection<SlotOffer> offers) Offers multiple slots to theSlotPool.booleanregisterTaskManager(ResourceID resourceID) Registers a TaskExecutor with the givenResourceIDatSlotPool.booleanreleaseTaskManager(ResourceID resourceId, Exception cause) Releases a TaskExecutor with the givenResourceIDfrom theSlotPool.default CompletableFuture<PhysicalSlot>requestNewAllocatedBatchSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile) Requests the allocation of a new batch slot from the resource manager.requestNewAllocatedBatchSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, Collection<AllocationID> preferredAllocations) default CompletableFuture<PhysicalSlot>requestNewAllocatedSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, Duration timeout) Request the allocation of a new slot from the resource manager.requestNewAllocatedSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, Collection<AllocationID> preferredAllocations, Duration timeout) Request the allocation of a new slot from the resource manager.voidsetIsJobRestarting(boolean isJobRestarting) Sets whether the underlying job is currently restarting or not.voidstart(JobMasterId jobMasterId, String newJobManagerAddress) Methods inherited from interface org.apache.flink.runtime.jobmaster.slotpool.AllocatedSlotActions
releaseSlot
-
Method Details
-
start
- Throws:
Exception
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-
connectToResourceManager
Connects the SlotPool to the given ResourceManager. After this method is called, the SlotPool will be able to request resources from the given ResourceManager.- Parameters:
resourceManagerGateway- The RPC gateway for the resource manager.
-
disconnectResourceManager
void disconnectResourceManager()Disconnects the slot pool from its current Resource Manager. After this call, the pool will not be able to request further slots from the Resource Manager, and all currently pending requests to the resource manager will be canceled.The slot pool will still be able to serve slots from its internal pool.
-
registerTaskManager
Registers a TaskExecutor with the givenResourceIDatSlotPool.- Parameters:
resourceID- identifying the TaskExecutor to register- Returns:
- true iff a new resource id was registered
-
releaseTaskManager
Releases a TaskExecutor with the givenResourceIDfrom theSlotPool.- Parameters:
resourceId- identifying the TaskExecutor which shall be released from the SlotPoolcause- for the releasing of the TaskManager- Returns:
- true iff a given registered resource id was removed
-
offerSlots
Collection<SlotOffer> offerSlots(TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, Collection<SlotOffer> offers) Offers multiple slots to theSlotPool. The slot offerings can be individually accepted or rejected by returning the collection of accepted slot offers.- Parameters:
taskManagerLocation- from which the slot offers originatetaskManagerGateway- to talk to the slot offereroffers- slot offers which are offered to theSlotPool- Returns:
- A collection of accepted slot offers. The remaining slot offers are implicitly rejected.
-
getFreeSlotTracker
FreeSlotTracker getFreeSlotTracker()Returns all free slot tracker.- Returns:
- all free slot tracker
-
getAllocatedSlotsInformation
Collection<SlotInfo> getAllocatedSlotsInformation()Returns a list ofSlotInfoobjects about all slots that are currently allocated in the slot pool.- Returns:
- a list of
SlotInfoobjects about all slots that are currently allocated in the slot pool.
-
allocateAvailableSlot
Optional<PhysicalSlot> allocateAvailableSlot(SlotRequestId slotRequestId, AllocationID allocationID, ResourceProfile requirementProfile) Allocates the available slot with the given allocation id under the given request id for the given requirement profile. The slot must be able to fulfill the requirement profile, otherwise anIllegalStateExceptionwill be thrown.- Parameters:
slotRequestId- identifying the requested slotallocationID- the allocation id of the requested available slotrequirementProfile- resource profile of the requirement for which to allocate the slot- Returns:
- the previously available slot with the given allocation id, if a slot with this allocation id exists
-
requestNewAllocatedSlot
default CompletableFuture<PhysicalSlot> requestNewAllocatedSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, @Nullable Duration timeout) Request the allocation of a new slot from the resource manager. This method will not return a slot from the already available slots from the pool, but instead will add a new slot to that pool that is immediately allocated and returned.- Parameters:
slotRequestId- identifying the requested slotresourceProfile- resource profile that specifies the resource requirements for the requested slottimeout- timeout for the allocation procedure- Returns:
- a newly allocated slot that was previously not available.
-
requestNewAllocatedSlot
CompletableFuture<PhysicalSlot> requestNewAllocatedSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, Collection<AllocationID> preferredAllocations, @Nullable Duration timeout) Request the allocation of a new slot from the resource manager. This method will not return a slot from the already available slots from the pool, but instead will add a new slot to that pool that is immediately allocated and returned.- Parameters:
slotRequestId- identifying the requested slotresourceProfile- resource profile that specifies the resource requirements for the requested slotpreferredAllocations- preferred allocations for the new allocated slottimeout- timeout for the allocation procedure- Returns:
- a newly allocated slot that was previously not available.
-
requestNewAllocatedBatchSlot
default CompletableFuture<PhysicalSlot> requestNewAllocatedBatchSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile) Requests the allocation of a new batch slot from the resource manager. Unlike the normal slot, a batch slot will only time out if the slot pool does not contain a suitable slot. Moreover, it won't react to failure signals from the resource manager.- Parameters:
slotRequestId- identifying the requested slotresourceProfile- resource profile that specifies the resource requirements for the requested batch slot- Returns:
- a future which is completed with newly allocated batch slot
-
requestNewAllocatedBatchSlot
CompletableFuture<PhysicalSlot> requestNewAllocatedBatchSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, Collection<AllocationID> preferredAllocations) -
disableBatchSlotRequestTimeoutCheck
void disableBatchSlotRequestTimeoutCheck()Disables batch slot request timeout check. Invoked when someone else wants to take over the timeout check responsibility. -
createAllocatedSlotReport
Create report about the allocated slots belonging to the specified task manager.- Parameters:
taskManagerId- identifies the task manager- Returns:
- the allocated slots on the task manager
-
setIsJobRestarting
void setIsJobRestarting(boolean isJobRestarting) Sets whether the underlying job is currently restarting or not.- Parameters:
isJobRestarting- whether the job is restarting or not
-