public interface SlotManager extends AutoCloseable
ResourceActions.allocateResource(ResourceProfile)
.
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 |
freeSlot(SlotID slotId,
AllocationID allocationId)
Free the given slot from the given allocation.
|
int |
getNumberFreeSlots() |
int |
getNumberFreeSlotsOf(InstanceID instanceId) |
int |
getNumberPendingSlotRequests() |
int |
getNumberPendingTaskManagerSlots() |
int |
getNumberRegisteredSlots() |
int |
getNumberRegisteredSlotsOf(InstanceID instanceId) |
boolean |
registerSlotRequest(SlotRequest slotRequest)
Requests a slot with the respective resource profile.
|
void |
registerTaskManager(TaskExecutorConnection taskExecutorConnection,
SlotReport initialSlotReport)
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.
|
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.
|
void |
unregisterTaskManagersAndReleaseResources() |
close
int getNumberRegisteredSlots()
int getNumberRegisteredSlotsOf(InstanceID instanceId)
int getNumberFreeSlots()
int getNumberFreeSlotsOf(InstanceID instanceId)
int getNumberPendingTaskManagerSlots()
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()
boolean registerSlotRequest(SlotRequest slotRequest) throws ResourceManagerException
slotRequest
- specifying the requested slot specsResourceManagerException
- if the slot request failed (e.g. not enough resources left)boolean unregisterSlotRequest(AllocationID allocationId)
allocationId
- identifying the pending slot requestvoid registerTaskManager(TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport)
taskExecutorConnection
- for the new task managerinitialSlotReport
- 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)
@VisibleForTesting void unregisterTaskManagersAndReleaseResources()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.