Class DeclarativeSlotPoolService

    • Field Detail

      • log

        protected final org.slf4j.Logger log
    • Method Detail

      • getRelativeTimeMillis

        protected long getRelativeTimeMillis()
      • castInto

        public <T> Optional<T> castInto​(Class<T> clazz)
        Description copied from interface: SlotPoolService
        Tries to cast this slot pool service into the given clazz.
        Specified by:
        castInto in interface SlotPoolService
        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

        public final void start​(JobMasterId jobMasterId,
                                String address)
                         throws Exception
        Description copied from interface: SlotPoolService
        Start the encapsulated slot pool implementation.
        Specified by:
        start in interface SlotPoolService
        Parameters:
        jobMasterId - jobMasterId to start the service with
        address - address of the owner
        Throws:
        Exception - if the service cannot be started
      • onStart

        protected void onStart()
        This method is called when the slot pool service is started. It can be overridden by subclasses.
      • assertHasBeenStarted

        protected void assertHasBeenStarted()
      • onClose

        protected void onClose()
        This method is called when the slot pool service is closed. It can be overridden by subclasses.
      • failAllocation

        public Optional<ResourceID> failAllocation​(@Nullable
                                                   ResourceID taskManagerId,
                                                   AllocationID allocationId,
                                                   Exception cause)
        Description copied from interface: SlotPoolService
        Fails the allocation with the given allocationId.
        Specified by:
        failAllocation in interface SlotPoolService
        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
      • onFailAllocation

        protected void onFailAllocation​(ResourceCounter previouslyFulfilledRequirements)
        This method is called when an allocation fails. It can be overridden by subclasses.
        Parameters:
        previouslyFulfilledRequirements - previouslyFulfilledRequirements by the failed allocation
      • releaseTaskManager

        public boolean releaseTaskManager​(ResourceID taskManagerId,
                                          Exception cause)
        Description copied from interface: SlotPoolService
        Releases a TaskExecutor with the given ResourceID from the SlotPoolService.
        Specified by:
        releaseTaskManager in interface 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

        public void releaseFreeSlotsOnTaskManager​(ResourceID taskManagerId,
                                                  Exception cause)
        Description copied from interface: SlotPoolService
        Releases all free slots belonging to the owning TaskExecutor if it has been registered.
        Specified by:
        releaseFreeSlotsOnTaskManager in interface SlotPoolService
        Parameters:
        taskManagerId - identifying the TaskExecutor
        cause - cause for failing the slots
      • onReleaseTaskManager

        protected void onReleaseTaskManager​(ResourceCounter previouslyFulfilledRequirement)
        This method is called when a TaskManager is released. It can be overridden by subclasses.
        Parameters:
        previouslyFulfilledRequirement - previouslyFulfilledRequirement by the released TaskManager
      • connectToResourceManager

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

        public void disconnectResourceManager()
        Description copied from interface: SlotPoolService
        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.

        Specified by:
        disconnectResourceManager in interface SlotPoolService
      • createAllocatedSlotReport

        public AllocatedSlotReport createAllocatedSlotReport​(ResourceID taskManagerId)
        Description copied from interface: SlotPoolService
        Create report about the allocated slots belonging to the specified task manager.
        Specified by:
        createAllocatedSlotReport in interface SlotPoolService
        Parameters:
        taskManagerId - identifies the task manager
        Returns:
        the allocated slots on the task manager
      • getSlotServiceStatus

        protected String getSlotServiceStatus()