public interface SlotPoolService extends AutoCloseable
JobMaster
to manage a slot pool.Modifier and Type | Method and Description |
---|---|
default <T> Optional<T> |
castInto(Class<T> clazz)
Tries to cast this slot pool service into the given clazz.
|
void |
close()
Close the slot pool service.
|
void |
connectToResourceManager(ResourceManagerGateway resourceManagerGateway)
Connects the SlotPool to the given ResourceManager.
|
AllocatedSlotReport |
createAllocatedSlotReport(ResourceID taskManagerId)
Create report about the allocated slots belonging to the specified task manager.
|
void |
disconnectResourceManager()
Disconnects the slot pool from its current Resource Manager.
|
Optional<ResourceID> |
failAllocation(ResourceID taskManagerId,
AllocationID allocationId,
Exception cause)
Fails the allocation with the given allocationId.
|
default void |
notifyNotEnoughResourcesAvailable(Collection<ResourceRequirement> acquiredResources)
Notifies that not enough resources are available to fulfill the resource requirements.
|
Collection<SlotOffer> |
offerSlots(TaskManagerLocation taskManagerLocation,
TaskManagerGateway taskManagerGateway,
Collection<SlotOffer> offers)
Offers multiple slots to the
SlotPoolService . |
boolean |
registerTaskManager(ResourceID taskManagerId)
Registers a TaskExecutor with the given
ResourceID at SlotPoolService . |
void |
releaseFreeSlotsOnTaskManager(ResourceID taskManagerId,
Exception cause)
Releases all free slots belonging to the owning TaskExecutor if it has been registered.
|
boolean |
releaseTaskManager(ResourceID taskManagerId,
Exception cause)
Releases a TaskExecutor with the given
ResourceID from the SlotPoolService . |
void |
start(JobMasterId jobMasterId,
String address,
ComponentMainThreadExecutor mainThreadExecutor)
Start the encapsulated slot pool implementation.
|
default <T> Optional<T> castInto(Class<T> clazz)
T
- type of clazzclazz
- to cast the slot pool service intoOptional.of(T)
the target type if it can be cast; otherwise Optional.empty()
void start(JobMasterId jobMasterId, String address, ComponentMainThreadExecutor mainThreadExecutor) throws Exception
jobMasterId
- jobMasterId to start the service withaddress
- address of the ownermainThreadExecutor
- mainThreadExecutor to run actions in the main threadException
- if the service cannot be startedvoid close()
close
in interface AutoCloseable
Collection<SlotOffer> offerSlots(TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, Collection<SlotOffer> offers)
SlotPoolService
. The slot offerings can be individually
accepted or rejected by returning the collection of accepted slot offers.taskManagerLocation
- from which the slot offers originatetaskManagerGateway
- to talk to the slot offereroffers
- slot offers which are offered to the SlotPoolService
Optional<ResourceID> failAllocation(@Nullable ResourceID taskManagerId, AllocationID allocationId, Exception cause)
taskManagerId
- taskManagerId is non-null if the signal comes from a TaskManager; if the
signal comes from the ResourceManager, then it is nullallocationId
- allocationId identifies which allocation to failcause
- cause why the allocation failedboolean registerTaskManager(ResourceID taskManagerId)
ResourceID
at SlotPoolService
.taskManagerId
- identifying the TaskExecutor to registerboolean releaseTaskManager(ResourceID taskManagerId, Exception cause)
ResourceID
from the SlotPoolService
.taskManagerId
- identifying the TaskExecutor which shall be released from the SlotPoolcause
- for the releasing of the TaskManagervoid releaseFreeSlotsOnTaskManager(ResourceID taskManagerId, Exception cause)
taskManagerId
- identifying the TaskExecutorcause
- cause for failing the slotsvoid connectToResourceManager(ResourceManagerGateway resourceManagerGateway)
resourceManagerGateway
- The RPC gateway for the resource manager.void disconnectResourceManager()
The slot pool will still be able to serve slots from its internal pool.
AllocatedSlotReport createAllocatedSlotReport(ResourceID taskManagerId)
taskManagerId
- identifies the task managerdefault void notifyNotEnoughResourcesAvailable(Collection<ResourceRequirement> acquiredResources)
acquiredResources
- the resources that have been acquiredCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.