Interface SlotPoolService

    • Method Detail

      • castInto

        default <T> Optional<T> castInto​(Class<T> clazz)
        Tries to cast this slot pool service into the given clazz.
        Type Parameters:
        T - type of clazz
        Parameters:
        clazz - to cast the slot pool service into
        Returns:
        Optional.of(T) the target type if it can be cast; otherwise Optional.empty()
      • start

        void start​(JobMasterId jobMasterId,
                   String address)
            throws Exception
        Start the encapsulated slot pool implementation.
        Parameters:
        jobMasterId - jobMasterId to start the service with
        address - address of the owner
        Throws:
        Exception - if the service cannot be started
      • close

        void close()
        Close the slot pool service.
        Specified by:
        close in interface AutoCloseable
      • offerSlots

        Collection<SlotOffer> offerSlots​(TaskManagerLocation taskManagerLocation,
                                         TaskManagerGateway taskManagerGateway,
                                         Collection<SlotOffer> offers)
        Offers multiple slots to the SlotPoolService. 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 SlotPoolService
        Returns:
        A collection of accepted slot offers. The remaining slot offers are implicitly rejected.
      • failAllocation

        Optional<ResourceID> failAllocation​(@Nullable
                                            ResourceID taskManagerId,
                                            AllocationID allocationId,
                                            Exception cause)
        Fails the allocation with the given allocationId.
        Parameters:
        taskManagerId - taskManagerId is non-null if the signal comes from a TaskManager; if the signal comes from the ResourceManager, then it is null
        allocationId - allocationId identifies which allocation to fail
        cause - cause why the allocation failed
        Returns:
        Optional task executor if it has no more slots registered
      • registerTaskManager

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

        boolean releaseTaskManager​(ResourceID taskManagerId,
                                   Exception cause)
        Releases a TaskExecutor with the given ResourceID from the SlotPoolService.
        Parameters:
        taskManagerId - 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
      • releaseFreeSlotsOnTaskManager

        void releaseFreeSlotsOnTaskManager​(ResourceID taskManagerId,
                                           Exception cause)
        Releases all free slots belonging to the owning TaskExecutor if it has been registered.
        Parameters:
        taskManagerId - identifying the TaskExecutor
        cause - cause for failing the slots
      • 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.

      • 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
      • notifyNotEnoughResourcesAvailable

        default void notifyNotEnoughResourcesAvailable​(Collection<ResourceRequirement> acquiredResources)
        Notifies that not enough resources are available to fulfill the resource requirements.
        Parameters:
        acquiredResources - the resources that have been acquired