Interface SlotPool

All Superinterfaces:
AllocatedSlotActions, AutoCloseable
All Known Implementing Classes:
DeclarativeSlotPoolBridge

public interface SlotPool extends AllocatedSlotActions, AutoCloseable
The Interface of a slot pool that manages slots.
  • Method Details

    • start

      void start(JobMasterId jobMasterId, String newJobManagerAddress) throws Exception
      Throws:
      Exception
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
    • connectToResourceManager

      void connectToResourceManager(ResourceManagerGateway resourceManagerGateway)
      Connects the SlotPool to the given ResourceManager. After this method is called, the SlotPool will be able to request resources from the given ResourceManager.
      Parameters:
      resourceManagerGateway - The RPC gateway for the resource manager.
    • disconnectResourceManager

      void disconnectResourceManager()
      Disconnects the slot pool from its current Resource Manager. After this call, the pool will not be able to request further slots from the Resource Manager, and all currently pending requests to the resource manager will be canceled.

      The slot pool will still be able to serve slots from its internal pool.

    • registerTaskManager

      boolean registerTaskManager(ResourceID resourceID)
      Registers a TaskExecutor with the given ResourceID at SlotPool.
      Parameters:
      resourceID - identifying the TaskExecutor to register
      Returns:
      true iff a new resource id was registered
    • releaseTaskManager

      boolean releaseTaskManager(ResourceID resourceId, Exception cause)
      Releases a TaskExecutor with the given ResourceID from the SlotPool.
      Parameters:
      resourceId - identifying the TaskExecutor which shall be released from the SlotPool
      cause - for the releasing of the TaskManager
      Returns:
      true iff a given registered resource id was removed
    • offerSlots

      Collection<SlotOffer> offerSlots(TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, Collection<SlotOffer> offers)
      Offers multiple slots to the SlotPool. The slot offerings can be individually accepted or rejected by returning the collection of accepted slot offers.
      Parameters:
      taskManagerLocation - from which the slot offers originate
      taskManagerGateway - to talk to the slot offerer
      offers - slot offers which are offered to the SlotPool
      Returns:
      A collection of accepted slot offers. The remaining slot offers are implicitly rejected.
    • getFreeSlotTracker

      FreeSlotTracker getFreeSlotTracker()
      Returns all free slot tracker.
      Returns:
      all free slot tracker
    • getAllocatedSlotsInformation

      Collection<SlotInfo> getAllocatedSlotsInformation()
      Returns a list of SlotInfo objects about all slots that are currently allocated in the slot pool.
      Returns:
      a list of SlotInfo objects about all slots that are currently allocated in the slot pool.
    • allocateAvailableSlot

      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. The slot must be able to fulfill the requirement profile, otherwise an IllegalStateException will be thrown.
      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

      default CompletableFuture<PhysicalSlot> requestNewAllocatedSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, @Nullable Duration timeout)
      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.
      Parameters:
      slotRequestId - identifying the requested slot
      resourceProfile - resource profile that specifies the resource requirements for the requested slot
      timeout - timeout for the allocation procedure
      Returns:
      a newly allocated slot that was previously not available.
    • requestNewAllocatedSlot

      CompletableFuture<PhysicalSlot> requestNewAllocatedSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, Collection<AllocationID> preferredAllocations, @Nullable Duration timeout)
      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.
      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.
    • requestNewAllocatedBatchSlot

      default CompletableFuture<PhysicalSlot> requestNewAllocatedBatchSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile)
      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.
      Parameters:
      slotRequestId - identifying the requested slot
      resourceProfile - resource profile that specifies the resource requirements for the requested batch slot
      Returns:
      a future which is completed with newly allocated batch slot
    • requestNewAllocatedBatchSlot

      CompletableFuture<PhysicalSlot> requestNewAllocatedBatchSlot(SlotRequestId slotRequestId, ResourceProfile resourceProfile, Collection<AllocationID> preferredAllocations)
    • disableBatchSlotRequestTimeoutCheck

      void disableBatchSlotRequestTimeoutCheck()
      Disables batch slot request timeout check. Invoked when someone else wants to take over the timeout check responsibility.
    • createAllocatedSlotReport

      AllocatedSlotReport createAllocatedSlotReport(ResourceID taskManagerId)
      Create report about the allocated slots belonging to the specified task manager.
      Parameters:
      taskManagerId - identifies the task manager
      Returns:
      the allocated slots on the task manager
    • setIsJobRestarting

      void setIsJobRestarting(boolean isJobRestarting)
      Sets whether the underlying job is currently restarting or not.
      Parameters:
      isJobRestarting - whether the job is restarting or not