public class DeclarativeSlotPoolBridge extends DeclarativeSlotPoolService implements SlotPool
SlotPool implementation which uses the DeclarativeSlotPool to allocate slots.log| Constructor and Description |
|---|
DeclarativeSlotPoolBridge(org.apache.flink.api.common.JobID jobId,
DeclarativeSlotPoolFactory declarativeSlotPoolFactory,
org.apache.flink.util.clock.Clock clock,
org.apache.flink.api.common.time.Time rpcTimeout,
org.apache.flink.api.common.time.Time idleSlotTimeout,
org.apache.flink.api.common.time.Time batchSlotTimeout,
RequestSlotMatchingStrategy requestSlotMatchingStrategy) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
<T> Optional<T> |
castInto(Class<T> clazz)
Tries to cast this slot pool service into the given clazz.
|
void |
disableBatchSlotRequestTimeoutCheck()
Disables batch slot request timeout check.
|
Collection<SlotInfo> |
getAllocatedSlotsInformation()
Returns a list of
SlotInfo objects about all slots that are currently allocated in
the slot pool. |
Collection<SlotInfoWithUtilization> |
getAvailableSlotsInformation()
Returns a list of
SlotInfoWithUtilization objects about all slots that are currently
available in the slot pool. |
int |
getNumPendingRequests() |
void |
notifyNotEnoughResourcesAvailable(Collection<ResourceRequirement> acquiredResources)
Notifies that not enough resources are available to fulfill the resource requirements.
|
Collection<SlotOffer> |
offerSlots(TaskManagerLocation taskManagerLocation,
TaskManagerGateway taskManagerGateway,
Collection<SlotOffer> offers)
Offers multiple slots to the
SlotPoolService. |
protected void |
onClose()
This method is called when the slot pool service is closed.
|
protected void |
onFailAllocation(ResourceCounter previouslyFulfilledRequirements)
This method is called when an allocation fails.
|
protected void |
onReleaseTaskManager(ResourceCounter previouslyFulfilledRequirement)
This method is called when a TaskManager is released.
|
protected void |
onStart(org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor componentMainThreadExecutor)
This method is called when the slot pool service is started.
|
void |
releaseSlot(SlotRequestId slotRequestId,
Throwable cause)
Releases the slot with the given
SlotRequestId. |
CompletableFuture<PhysicalSlot> |
requestNewAllocatedBatchSlot(SlotRequestId slotRequestId,
ResourceProfile resourceProfile,
Collection<AllocationID> preferredAllocations) |
CompletableFuture<PhysicalSlot> |
requestNewAllocatedSlot(SlotRequestId slotRequestId,
ResourceProfile resourceProfile,
Collection<AllocationID> preferredAllocations,
org.apache.flink.api.common.time.Time timeout)
Request the allocation of a new slot from the resource manager.
|
void |
setIsJobRestarting(boolean isJobRestarting)
To set whether the underlying is currently restarting or not.
|
assertHasBeenStarted, close, connectToResourceManager, createAllocatedSlotReport, disconnectResourceManager, failAllocation, getDeclarativeSlotPool, getRelativeTimeMillis, getSlotServiceStatus, registerTaskManager, releaseTaskManager, startclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, connectToResourceManager, createAllocatedSlotReport, disconnectResourceManager, registerTaskManager, releaseTaskManager, requestNewAllocatedBatchSlot, requestNewAllocatedSlot, startpublic DeclarativeSlotPoolBridge(org.apache.flink.api.common.JobID jobId,
DeclarativeSlotPoolFactory declarativeSlotPoolFactory,
org.apache.flink.util.clock.Clock clock,
org.apache.flink.api.common.time.Time rpcTimeout,
org.apache.flink.api.common.time.Time idleSlotTimeout,
org.apache.flink.api.common.time.Time batchSlotTimeout,
RequestSlotMatchingStrategy requestSlotMatchingStrategy)
public <T> Optional<T> castInto(Class<T> clazz)
SlotPoolServicecastInto in interface SlotPoolServicecastInto in class DeclarativeSlotPoolServiceT - type of clazzclazz - to cast the slot pool service intoOptional.of(T) the target type if it can be cast; otherwise Optional.empty()protected void onStart(org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor componentMainThreadExecutor)
DeclarativeSlotPoolServiceonStart in class DeclarativeSlotPoolServicecomponentMainThreadExecutor - componentMainThreadExecutor used by this slot pool serviceprotected void onClose()
DeclarativeSlotPoolServiceonClose in class DeclarativeSlotPoolServicepublic void setIsJobRestarting(boolean isJobRestarting)
setIsJobRestarting in interface SlotPoolisJobRestarting - whether this is restarting or notpublic Collection<SlotOffer> offerSlots(TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, Collection<SlotOffer> offers)
SlotPoolServiceSlotPoolService. The slot offerings can be individually
accepted or rejected by returning the collection of accepted slot offers.offerSlots in interface SlotPoolofferSlots in interface SlotPoolServiceofferSlots in class DeclarativeSlotPoolServicetaskManagerLocation - from which the slot offers originatetaskManagerGateway - to talk to the slot offereroffers - slot offers which are offered to the SlotPoolServiceprotected void onReleaseTaskManager(ResourceCounter previouslyFulfilledRequirement)
DeclarativeSlotPoolServiceonReleaseTaskManager in class DeclarativeSlotPoolServicepreviouslyFulfilledRequirement - previouslyFulfilledRequirement by the released
TaskManagerpublic Optional<PhysicalSlot> allocateAvailableSlot(@Nonnull SlotRequestId slotRequestId, @Nonnull AllocationID allocationID, @Nonnull ResourceProfile requirementProfile)
SlotPoolIllegalStateException will be thrown.allocateAvailableSlot in interface SlotPoolslotRequestId - identifying the requested slotallocationID - the allocation id of the requested available slotrequirementProfile - resource profile of the requirement for which to allocate the slot@Nonnull public CompletableFuture<PhysicalSlot> requestNewAllocatedSlot(@Nonnull SlotRequestId slotRequestId, @Nonnull ResourceProfile resourceProfile, @Nonnull Collection<AllocationID> preferredAllocations, @Nullable org.apache.flink.api.common.time.Time timeout)
SlotPoolrequestNewAllocatedSlot in interface SlotPoolslotRequestId - 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@Nonnull public CompletableFuture<PhysicalSlot> requestNewAllocatedBatchSlot(@Nonnull SlotRequestId slotRequestId, @Nonnull ResourceProfile resourceProfile, @Nonnull Collection<AllocationID> preferredAllocations)
requestNewAllocatedBatchSlot in interface SlotPoolprotected void onFailAllocation(ResourceCounter previouslyFulfilledRequirements)
DeclarativeSlotPoolServiceonFailAllocation in class DeclarativeSlotPoolServicepreviouslyFulfilledRequirements - previouslyFulfilledRequirements by the failed
allocationpublic void releaseSlot(@Nonnull SlotRequestId slotRequestId, @Nullable Throwable cause)
AllocatedSlotActionsSlotRequestId. Additionally, one can provide a cause
for the slot release.releaseSlot in interface AllocatedSlotActionsslotRequestId - identifying the slot to releasecause - of the slot release, null if nonepublic void notifyNotEnoughResourcesAvailable(Collection<ResourceRequirement> acquiredResources)
SlotPoolServicenotifyNotEnoughResourcesAvailable in interface SlotPoolServiceacquiredResources - the resources that have been acquiredpublic Collection<SlotInfo> getAllocatedSlotsInformation()
SlotPoolSlotInfo objects about all slots that are currently allocated in
the slot pool.getAllocatedSlotsInformation in interface SlotPoolSlotInfo objects about all slots that are currently allocated in
the slot pool.@Nonnull public Collection<SlotInfoWithUtilization> getAvailableSlotsInformation()
SlotPoolSlotInfoWithUtilization objects about all slots that are currently
available in the slot pool.getAvailableSlotsInformation in interface SlotPoolSlotInfoWithUtilization objects about all slots that are currently
available in the slot pool.public void disableBatchSlotRequestTimeoutCheck()
SlotPooldisableBatchSlotRequestTimeoutCheck in interface SlotPool@VisibleForTesting public int getNumPendingRequests()
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.