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 slotBatchAllocatable,
                                         @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​(@Nonnull
                                                            SlotRequestId slotRequestId,
                                                            @Nonnull
                                                            AllocationID allocationID,
                                                            @Nonnull
                                                            ResourceProfile requirementProfile)
        Description copied from interface: SlotPool
        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 an IllegalStateException will be thrown.
        Specified by:
        allocateAvailableSlot in interface SlotPool
        Parameters:
        slotRequestId - identifying the requested slot
        allocationID - the allocation id of the requested available slot
        requirementProfile - 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

        @Nonnull
        public CompletableFuture<PhysicalSlot> requestNewAllocatedSlot​(@Nonnull
                                                                       SlotRequestId slotRequestId,
                                                                       @Nonnull
                                                                       ResourceProfile resourceProfile,
                                                                       @Nonnull
                                                                       Collection<AllocationID> preferredAllocations,
                                                                       @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:
        slotRequestId - identifying the requested slot
        resourceProfile - resource profile that specifies the resource requirements for the requested slot
        preferredAllocations - preferred allocations for the new allocated slot
        timeout - timeout for the allocation procedure
        Returns:
        a newly allocated slot that was previously not available.
      • 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()