Class DeclarativeSlotPoolBridge

    • Constructor Detail

      • DeclarativeSlotPoolBridge

        public DeclarativeSlotPoolBridge​(org.apache.flink.api.common.JobID jobId,
                                         DeclarativeSlotPoolFactory declarativeSlotPoolFactory,
                                         org.apache.flink.util.clock.Clock clock,
                                         Duration rpcTimeout,
                                         Duration idleSlotTimeout,
                                         Duration batchSlotTimeout,
                                         RequestSlotMatchingStrategy requestSlotMatchingStrategy,
                                         Duration slotRequestMaxInterval,
                                         boolean deferSlotAllocation,
                                         @Nonnull
                                         org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor componentMainThreadExecutor)
    • Method Detail

      • setIsJobRestarting

        public void setIsJobRestarting​(boolean isJobRestarting)
        To set whether the underlying is currently restarting or not. In the former case the slot pool bridge will accept all incoming slot offers.
        Specified by:
        setIsJobRestarting in interface SlotPool
        Parameters:
        isJobRestarting - whether this is restarting or not
      • onReleaseTaskManager

        protected void onReleaseTaskManager​(ResourceCounter previouslyFulfilledRequirement)
        Description copied from class: DeclarativeSlotPoolService
        This method is called when a TaskManager is released. It can be overridden by subclasses.
        Overrides:
        onReleaseTaskManager in class DeclarativeSlotPoolService
        Parameters:
        previouslyFulfilledRequirement - previouslyFulfilledRequirement by the released TaskManager
      • allocateAvailableSlot

        public Optional<PhysicalSlot> allocateAvailableSlot​(AllocationID allocationID,
                                                            PhysicalSlotRequest physicalSlotRequest)
        Description copied from interface: SlotPool
        Allocates the available slot with the given physical slot request. The slot must be able to fulfill the requirement profile, otherwise an IllegalStateException will be thrown.
        Specified by:
        allocateAvailableSlot in interface SlotPool
        Parameters:
        allocationID - the allocation id of the requested available slot
        physicalSlotRequest - the physical slot request.
        Returns:
        the previously available slot with the given allocation id, if a slot with this allocation id exists
      • requestNewAllocatedSlot

        public CompletableFuture<PhysicalSlot> requestNewAllocatedSlot​(PhysicalSlotRequest physicalSlotRequest,
                                                                       @Nullable
                                                                       Duration timeout)
        Description copied from interface: SlotPool
        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.
        Specified by:
        requestNewAllocatedSlot in interface SlotPool
        Parameters:
        physicalSlotRequest - the physical slot request descriptor.
        timeout - timeout for the allocation procedure
        Returns:
        a newly allocated slot that was previously not available.
      • requestNewAllocatedBatchSlot

        public CompletableFuture<PhysicalSlot> requestNewAllocatedBatchSlot​(PhysicalSlotRequest physicalSlotRequest)
        Description copied from interface: SlotPool
        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.
        Specified by:
        requestNewAllocatedBatchSlot in interface SlotPool
        Parameters:
        physicalSlotRequest - the physical slot request descriptor.
        Returns:
        a future which is completed with newly allocated batch slot
      • onFailAllocation

        protected void onFailAllocation​(ResourceCounter previouslyFulfilledRequirements)
        Description copied from class: DeclarativeSlotPoolService
        This method is called when an allocation fails. It can be overridden by subclasses.
        Overrides:
        onFailAllocation in class DeclarativeSlotPoolService
        Parameters:
        previouslyFulfilledRequirements - previouslyFulfilledRequirements by the failed allocation
      • releaseSlot

        public void releaseSlot​(@Nonnull
                                SlotRequestId slotRequestId,
                                @Nullable
                                Throwable cause)
        Description copied from interface: AllocatedSlotActions
        Releases the slot with the given SlotRequestId. Additionally, one can provide a cause for the slot release.
        Specified by:
        releaseSlot in interface AllocatedSlotActions
        Parameters:
        slotRequestId - identifying the slot to release
        cause - of the slot release, null if none
      • getAllocatedSlotsInformation

        public Collection<SlotInfo> getAllocatedSlotsInformation()
        Description copied from interface: SlotPool
        Returns a list of SlotInfo objects about all slots that are currently allocated in the slot pool.
        Specified by:
        getAllocatedSlotsInformation in interface SlotPool
        Returns:
        a list of SlotInfo objects about all slots that are currently allocated in the slot pool.
      • disableBatchSlotRequestTimeoutCheck

        public void disableBatchSlotRequestTimeoutCheck()
        Description copied from interface: SlotPool
        Disables batch slot request timeout check. Invoked when someone else wants to take over the timeout check responsibility.
        Specified by:
        disableBatchSlotRequestTimeoutCheck in interface SlotPool
      • getNumPendingRequests

        @VisibleForTesting
        public int getNumPendingRequests()