public interface SlotManager extends AutoCloseable
ResourceActions.allocateResource(WorkerResourceSpec)
.
In order to free resources and avoid resource leaks, idling task managers (task managers whose slots are currently not used) and pending slot requests time out triggering their release and failure, respectively.
Modifier and Type | Method and Description |
---|---|
void |
clearResourceRequirements(JobID jobId)
Notifies the slot manager that the resource requirements for the given job should be cleared.
|
void |
freeSlot(SlotID slotId,
AllocationID allocationId)
Free the given slot from the given allocation.
|
Collection<SlotInfo> |
getAllocatedSlotsOf(InstanceID instanceID) |
ResourceProfile |
getFreeResource() |
ResourceProfile |
getFreeResourceOf(InstanceID instanceID) |
int |
getNumberFreeSlots() |
int |
getNumberFreeSlotsOf(InstanceID instanceId) |
int |
getNumberPendingSlotRequests() |
int |
getNumberRegisteredSlots() |
int |
getNumberRegisteredSlotsOf(InstanceID instanceId) |
ResourceProfile |
getRegisteredResource() |
ResourceProfile |
getRegisteredResourceOf(InstanceID instanceID) |
Map<WorkerResourceSpec,Integer> |
getRequiredResources()
Get number of workers SlotManager requested from
ResourceActions that are not yet
fulfilled. |
void |
processResourceRequirements(ResourceRequirements resourceRequirements)
Notifies the slot manager about the resource requirements of a job.
|
default boolean |
registerSlotRequest(SlotRequest slotRequest)
Requests a slot with the respective resource profile.
|
boolean |
registerTaskManager(TaskExecutorConnection taskExecutorConnection,
SlotReport initialSlotReport,
ResourceProfile totalResourceProfile,
ResourceProfile defaultSlotResourceProfile)
Registers a new task manager at the slot manager.
|
boolean |
reportSlotStatus(InstanceID instanceId,
SlotReport slotReport)
Reports the current slot allocations for a task manager identified by the given instance id.
|
void |
setFailUnfulfillableRequest(boolean failUnfulfillableRequest) |
void |
start(ResourceManagerId newResourceManagerId,
Executor newMainThreadExecutor,
ResourceActions newResourceActions)
Starts the slot manager with the given leader id and resource manager actions.
|
void |
suspend()
Suspends the component.
|
default boolean |
unregisterSlotRequest(AllocationID allocationId)
Cancels and removes a pending slot request with the given allocation id.
|
boolean |
unregisterTaskManager(InstanceID instanceId,
Exception cause)
Unregisters the task manager identified by the given instance id and its associated slots
from the slot manager.
|
close
int getNumberRegisteredSlots()
int getNumberRegisteredSlotsOf(InstanceID instanceId)
int getNumberFreeSlots()
int getNumberFreeSlotsOf(InstanceID instanceId)
Map<WorkerResourceSpec,Integer> getRequiredResources()
ResourceActions
that are not yet
fulfilled.ResourceProfile getRegisteredResource()
ResourceProfile getRegisteredResourceOf(InstanceID instanceID)
ResourceProfile getFreeResource()
ResourceProfile getFreeResourceOf(InstanceID instanceID)
Collection<SlotInfo> getAllocatedSlotsOf(InstanceID instanceID)
int getNumberPendingSlotRequests()
void start(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceActions newResourceActions)
newResourceManagerId
- to use for communication with the task managersnewMainThreadExecutor
- to use to run code in the ResourceManager's main threadnewResourceActions
- to use for resource (de-)allocationsvoid suspend()
void clearResourceRequirements(JobID jobId)
jobId
- job for which to clear the requirementsvoid processResourceRequirements(ResourceRequirements resourceRequirements)
resourceRequirements
- resource requirements of a jobdefault boolean registerSlotRequest(SlotRequest slotRequest) throws ResourceManagerException
slotRequest
- specifying the requested slot specsResourceManagerException
- if the slot request failed (e.g. not enough resources left)default boolean unregisterSlotRequest(AllocationID allocationId)
allocationId
- identifying the pending slot requestboolean registerTaskManager(TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport, ResourceProfile totalResourceProfile, ResourceProfile defaultSlotResourceProfile)
taskExecutorConnection
- for the new task managerinitialSlotReport
- for the new task managertotalResourceProfile
- for the new task managerdefaultSlotResourceProfile
- for the new task managerboolean unregisterTaskManager(InstanceID instanceId, Exception cause)
instanceId
- identifying the task manager to unregistercause
- for unregistering the TaskManagerboolean reportSlotStatus(InstanceID instanceId, SlotReport slotReport)
instanceId
- identifying the task manager for which to report the slot statusslotReport
- containing the status for all of its slotsvoid freeSlot(SlotID slotId, AllocationID allocationId)
slotId
- identifying the slot to freeallocationId
- with which the slot is presumably allocatedvoid setFailUnfulfillableRequest(boolean failUnfulfillableRequest)
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.