public class DeclarativeSlotPoolBridge extends DeclarativeSlotPoolService implements SlotPool
SlotPool
implementation which uses the DeclarativeSlotPool
to allocate slots.log
Constructor and Description |
---|
DeclarativeSlotPoolBridge(JobID jobId,
DeclarativeSlotPoolFactory declarativeSlotPoolFactory,
Clock clock,
Time rpcTimeout,
Time idleSlotTimeout,
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.
|
Optional<ResourceID> |
failAllocation(AllocationID allocationID,
Exception cause)
Fails the slot with the given allocation id.
|
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. |
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(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,
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, start
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, connectToResourceManager, createAllocatedSlotReport, disconnectResourceManager, offerSlots, registerTaskManager, releaseTaskManager, start
public <T> Optional<T> castInto(Class<T> clazz)
SlotPoolService
castInto
in interface SlotPoolService
castInto
in class DeclarativeSlotPoolService
T
- 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(ComponentMainThreadExecutor componentMainThreadExecutor)
DeclarativeSlotPoolService
onStart
in class DeclarativeSlotPoolService
componentMainThreadExecutor
- componentMainThreadExecutor used by this slot pool serviceprotected void onClose()
DeclarativeSlotPoolService
onClose
in class DeclarativeSlotPoolService
protected void onReleaseTaskManager(ResourceCounter previouslyFulfilledRequirement)
DeclarativeSlotPoolService
onReleaseTaskManager
in class DeclarativeSlotPoolService
previouslyFulfilledRequirement
- previouslyFulfilledRequirement by the released
TaskManagerpublic Optional<PhysicalSlot> allocateAvailableSlot(@Nonnull SlotRequestId slotRequestId, @Nonnull AllocationID allocationID, @Nonnull ResourceProfile requirementProfile)
SlotPool
IllegalStateException
will be thrown.allocateAvailableSlot
in interface SlotPool
slotRequestId
- 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 Time timeout)
SlotPool
requestNewAllocatedSlot
in interface SlotPool
slotRequestId
- 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)
SlotPool
requestNewAllocatedBatchSlot
in interface SlotPool
slotRequestId
- identifying the requested slotresourceProfile
- resource profile that specifies the resource requirements for the
requested batch slotpublic Optional<ResourceID> failAllocation(AllocationID allocationID, Exception cause)
SlotPool
failAllocation
in interface SlotPool
allocationID
- identifying the slot which is being failedcause
- of the failureprotected void onFailAllocation(ResourceCounter previouslyFulfilledRequirements)
DeclarativeSlotPoolService
onFailAllocation
in class DeclarativeSlotPoolService
previouslyFulfilledRequirements
- previouslyFulfilledRequirements by the failed
allocationpublic void releaseSlot(@Nonnull SlotRequestId slotRequestId, @Nullable Throwable cause)
AllocatedSlotActions
SlotRequestId
. Additionally, one can provide a cause
for the slot release.releaseSlot
in interface AllocatedSlotActions
slotRequestId
- identifying the slot to releasecause
- of the slot release, null if nonepublic void notifyNotEnoughResourcesAvailable(Collection<ResourceRequirement> acquiredResources)
SlotPoolService
notifyNotEnoughResourcesAvailable
in interface SlotPoolService
acquiredResources
- the resources that have been acquiredpublic Collection<SlotInfo> getAllocatedSlotsInformation()
SlotPool
SlotInfo
objects about all slots that are currently allocated in
the slot pool.getAllocatedSlotsInformation
in interface SlotPool
SlotInfo
objects about all slots that are currently allocated in
the slot pool.@Nonnull public Collection<SlotInfoWithUtilization> getAvailableSlotsInformation()
SlotPool
SlotInfoWithUtilization
objects about all slots that are currently
available in the slot pool.getAvailableSlotsInformation
in interface SlotPool
SlotInfoWithUtilization
objects about all slots that are currently
available in the slot pool.public void disableBatchSlotRequestTimeoutCheck()
SlotPool
disableBatchSlotRequestTimeoutCheck
in interface SlotPool
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.