public class DeclarativeSlotManager extends Object implements SlotManager
SlotManager
supporting declarative slot management.Constructor and Description |
---|
DeclarativeSlotManager(ScheduledExecutor scheduledExecutor,
SlotManagerConfiguration slotManagerConfiguration,
SlotManagerMetricGroup slotManagerMetricGroup,
ResourceTracker resourceTracker,
org.apache.flink.runtime.resourcemanager.slotmanager.SlotTracker slotTracker) |
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 |
close()
Closes the slot manager.
|
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 |
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.
|
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,
BlockedTaskManagerChecker newBlockedTaskManagerChecker)
Starts the slot manager with the given leader id and resource manager actions.
|
void |
suspend()
Suspends the component.
|
void |
triggerResourceRequirementsCheck()
Trigger the resource requirement check.
|
boolean |
unregisterTaskManager(InstanceID instanceId,
Exception cause)
Unregisters the task manager identified by the given instance id and its associated slots
from the slot manager.
|
public DeclarativeSlotManager(ScheduledExecutor scheduledExecutor, SlotManagerConfiguration slotManagerConfiguration, SlotManagerMetricGroup slotManagerMetricGroup, ResourceTracker resourceTracker, org.apache.flink.runtime.resourcemanager.slotmanager.SlotTracker slotTracker)
public void setFailUnfulfillableRequest(boolean failUnfulfillableRequest)
setFailUnfulfillableRequest
in interface SlotManager
public void triggerResourceRequirementsCheck()
SlotManager
triggerResourceRequirementsCheck
in interface SlotManager
public void start(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceActions newResourceActions, BlockedTaskManagerChecker newBlockedTaskManagerChecker)
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-)allocationsnewBlockedTaskManagerChecker
- to query whether a task manager is blockedpublic void suspend()
suspend
in interface SlotManager
public void close() throws Exception
close
in interface AutoCloseable
Exception
- if the close operation failspublic void clearResourceRequirements(JobID jobId)
SlotManager
clearResourceRequirements
in interface SlotManager
jobId
- job for which to clear the requirementspublic void processResourceRequirements(ResourceRequirements resourceRequirements)
SlotManager
processResourceRequirements
in interface SlotManager
resourceRequirements
- resource requirements of a jobpublic boolean registerTaskManager(TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport, ResourceProfile totalResourceProfile, ResourceProfile defaultSlotResourceProfile)
registerTaskManager
in interface SlotManager
taskExecutorConnection
- for the new task managerinitialSlotReport
- for the new task managertotalResourceProfile
- for the new task managerdefaultSlotResourceProfile
- 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 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 Map<WorkerResourceSpec,Integer> getRequiredResources()
SlotManager
ResourceActions
that are not yet
fulfilled.getRequiredResources
in interface SlotManager
public ResourceProfile getRegisteredResource()
getRegisteredResource
in interface SlotManager
public ResourceProfile getRegisteredResourceOf(InstanceID instanceID)
getRegisteredResourceOf
in interface SlotManager
public ResourceProfile getFreeResource()
getFreeResource
in interface SlotManager
public ResourceProfile getFreeResourceOf(InstanceID instanceID)
getFreeResourceOf
in interface SlotManager
public Collection<SlotInfo> getAllocatedSlotsOf(InstanceID instanceID)
getAllocatedSlotsOf
in interface SlotManager
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.