public class SlotManagerImpl extends Object implements SlotManager
SlotManager
.Constructor and Description |
---|
SlotManagerImpl(SlotMatchingStrategy slotMatchingStrategy,
ScheduledExecutor scheduledExecutor,
Time taskManagerRequestTimeout,
Time slotRequestTimeout,
Time taskManagerTimeout,
boolean waitResultConsumedBeforeRelease) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the slot manager.
|
void |
freeSlot(SlotID slotId,
AllocationID allocationId)
Free the given slot from the given allocation.
|
int |
getNumberAssignedPendingTaskManagerSlots() |
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() |
public SlotManagerImpl(SlotMatchingStrategy slotMatchingStrategy, ScheduledExecutor scheduledExecutor, Time taskManagerRequestTimeout, Time slotRequestTimeout, Time taskManagerTimeout, boolean waitResultConsumedBeforeRelease)
public int getNumberRegisteredSlots()
getNumberRegisteredSlots
in interface SlotManager
public int getNumberRegisteredSlotsOf(InstanceID instanceId)
getNumberRegisteredSlotsOf
in interface SlotManager
public int getNumberFreeSlots()
getNumberFreeSlots
in interface SlotManager
public int getNumberFreeSlotsOf(InstanceID instanceId)
getNumberFreeSlotsOf
in interface SlotManager
public int getNumberPendingTaskManagerSlots()
getNumberPendingTaskManagerSlots
in interface SlotManager
public int getNumberPendingSlotRequests()
getNumberPendingSlotRequests
in interface SlotManager
@VisibleForTesting public int getNumberAssignedPendingTaskManagerSlots()
public void start(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceActions newResourceActions)
start
in interface SlotManager
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-)allocationspublic void suspend()
suspend
in interface SlotManager
public void close() throws Exception
close
in interface AutoCloseable
Exception
- if the close operation failspublic boolean registerSlotRequest(SlotRequest slotRequest) throws ResourceManagerException
registerSlotRequest
in interface SlotManager
slotRequest
- specifying the requested slot specsResourceManagerException
- if the slot request failed (e.g. not enough resources left)public boolean unregisterSlotRequest(AllocationID allocationId)
unregisterSlotRequest
in interface SlotManager
allocationId
- identifying the pending slot requestpublic void registerTaskManager(TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport)
registerTaskManager
in interface SlotManager
taskExecutorConnection
- for the new task managerinitialSlotReport
- for the new task managerpublic boolean unregisterTaskManager(InstanceID instanceId, Exception cause)
SlotManager
unregisterTaskManager
in interface SlotManager
instanceId
- identifying the task manager to unregistercause
- for unregistering the TaskManagerpublic boolean reportSlotStatus(InstanceID instanceId, SlotReport slotReport)
reportSlotStatus
in interface SlotManager
instanceId
- identifying the task manager for which to report the slot statusslotReport
- containing the status for all of its slotspublic void freeSlot(SlotID slotId, AllocationID allocationId)
freeSlot
in interface SlotManager
slotId
- identifying the slot to freeallocationId
- with which the slot is presumably allocatedpublic void setFailUnfulfillableRequest(boolean failUnfulfillableRequest)
setFailUnfulfillableRequest
in interface SlotManager
@VisibleForTesting public void unregisterTaskManagersAndReleaseResources()
unregisterTaskManagersAndReleaseResources
in interface SlotManager
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.