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) |
| 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.
|
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)
Requests the allocation of a new batch slot from the resource manager.
|
CompletableFuture<PhysicalSlot> |
requestNewAllocatedSlot(SlotRequestId slotRequestId,
ResourceProfile resourceProfile,
org.apache.flink.api.common.time.Time timeout)
Request the allocation of a new slot from the resource manager.
|
assertHasBeenStarted, close, connectToResourceManager, createAllocatedSlotReport, disconnectResourceManager, failAllocation, getDeclarativeSlotPool, getRelativeTimeMillis, getSlotServiceStatus, offerSlots, registerTaskManager, releaseTaskManager, startclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, connectToResourceManager, createAllocatedSlotReport, disconnectResourceManager, offerSlots, registerTaskManager, releaseTaskManager, 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)
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 DeclarativeSlotPoolServiceprotected 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, @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 slottimeout - timeout for the allocation procedure@Nonnull public CompletableFuture<PhysicalSlot> requestNewAllocatedBatchSlot(@Nonnull SlotRequestId slotRequestId, @Nonnull ResourceProfile resourceProfile)
SlotPoolrequestNewAllocatedBatchSlot in interface SlotPoolslotRequestId - identifying the requested slotresourceProfile - resource profile that specifies the resource requirements for the
requested batch slotprotected 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.