Class FineGrainedSlotManager
java.lang.Object
org.apache.flink.runtime.resourcemanager.slotmanager.FineGrainedSlotManager
- All Implemented Interfaces:
AutoCloseable,SlotManager
Implementation of
SlotManager supporting fine-grained resource management.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager
SlotManager.RegistrationResult -
Constructor Summary
ConstructorsConstructorDescriptionFineGrainedSlotManager(org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor, SlotManagerConfiguration slotManagerConfiguration, SlotManagerMetricGroup slotManagerMetricGroup, ResourceTracker resourceTracker, org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerTracker taskManagerTracker, SlotStatusSyncer slotStatusSyncer, ResourceAllocationStrategy resourceAllocationStrategy) -
Method Summary
Modifier and TypeMethodDescriptionvoidclearResourceRequirements(org.apache.flink.api.common.JobID jobId) Notifies the slot manager that the resource requirements for the given job should be cleared.voidclose()Closes the slot manager.voidfreeSlot(SlotID slotId, AllocationID allocationId) Free the given slot from the given allocation.getAllocatedSlotsOf(InstanceID instanceID) getFreeResourceOf(InstanceID instanceID) intintgetNumberFreeSlotsOf(InstanceID instanceId) intintgetNumberRegisteredSlotsOf(InstanceID instanceId) getRegisteredResourceOf(InstanceID instanceID) longgetTaskManagerIdleSince(InstanceID instanceId) voidprocessResourceRequirements(ResourceRequirements resourceRequirements) Notifies the slot manager about the resource requirements of a job.registerTaskManager(TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport, ResourceProfile totalResourceProfile, ResourceProfile defaultSlotResourceProfile) Registers a new task manager at the slot manager.booleanreportSlotStatus(InstanceID instanceId, SlotReport slotReport) Reports the current slot allocations for a task manager identified by the given instance id.voidsetFailUnfulfillableRequest(boolean failUnfulfillableRequest) voidstart(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceAllocator newResourceAllocator, ResourceEventListener newResourceEventListener, BlockedTaskManagerChecker newBlockedTaskManagerChecker) Starts the slot manager with the given leader id and resource manager actions.voidsuspend()Suspends the component.voidTrigger the resource requirement check.booleanunregisterTaskManager(InstanceID instanceId, Exception cause) Unregisters the task manager identified by the given instance id and its associated slots from the slot manager.
-
Constructor Details
-
FineGrainedSlotManager
public FineGrainedSlotManager(org.apache.flink.util.concurrent.ScheduledExecutor scheduledExecutor, SlotManagerConfiguration slotManagerConfiguration, SlotManagerMetricGroup slotManagerMetricGroup, ResourceTracker resourceTracker, org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerTracker taskManagerTracker, SlotStatusSyncer slotStatusSyncer, ResourceAllocationStrategy resourceAllocationStrategy)
-
-
Method Details
-
setFailUnfulfillableRequest
public void setFailUnfulfillableRequest(boolean failUnfulfillableRequest) - Specified by:
setFailUnfulfillableRequestin interfaceSlotManager
-
triggerResourceRequirementsCheck
public void triggerResourceRequirementsCheck()Description copied from interface:SlotManagerTrigger the resource requirement check. This method will be called when some slot statuses changed.- Specified by:
triggerResourceRequirementsCheckin interfaceSlotManager
-
start
public void start(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceAllocator newResourceAllocator, ResourceEventListener newResourceEventListener, BlockedTaskManagerChecker newBlockedTaskManagerChecker) Starts the slot manager with the given leader id and resource manager actions.- Specified by:
startin interfaceSlotManager- Parameters:
newResourceManagerId- to use for communication with the task managersnewMainThreadExecutor- to use to run code in the ResourceManager's main threadnewResourceAllocator- to use for resource (de-)allocationsnewBlockedTaskManagerChecker- to query whether a task manager is blockednewResourceEventListener- to use for notify resource not enough
-
suspend
public void suspend()Suspends the component. This clears the internal state of the slot manager.- Specified by:
suspendin interfaceSlotManager
-
close
Closes the slot manager.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- if the close operation fails
-
clearResourceRequirements
public void clearResourceRequirements(org.apache.flink.api.common.JobID jobId) Description copied from interface:SlotManagerNotifies the slot manager that the resource requirements for the given job should be cleared. The slot manager may assume that no further updates to the resource requirements will occur.- Specified by:
clearResourceRequirementsin interfaceSlotManager- Parameters:
jobId- job for which to clear the requirements
-
processResourceRequirements
Description copied from interface:SlotManagerNotifies the slot manager about the resource requirements of a job.- Specified by:
processResourceRequirementsin interfaceSlotManager- Parameters:
resourceRequirements- resource requirements of a job
-
registerTaskManager
public SlotManager.RegistrationResult registerTaskManager(TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport, ResourceProfile totalResourceProfile, ResourceProfile defaultSlotResourceProfile) Description copied from interface:SlotManagerRegisters a new task manager at the slot manager. This will make the task managers slots known and, thus, available for allocation.- Specified by:
registerTaskManagerin interfaceSlotManager- Parameters:
taskExecutorConnection- for the new task managerinitialSlotReport- for the new task managertotalResourceProfile- for the new task managerdefaultSlotResourceProfile- for the new task manager- Returns:
- The result of task manager registration
-
unregisterTaskManager
Description copied from interface:SlotManagerUnregisters the task manager identified by the given instance id and its associated slots from the slot manager.- Specified by:
unregisterTaskManagerin interfaceSlotManager- Parameters:
instanceId- identifying the task manager to unregistercause- for unregistering the TaskManager- Returns:
- True if there existed a registered task manager with the given instance id
-
reportSlotStatus
Reports the current slot allocations for a task manager identified by the given instance id.- Specified by:
reportSlotStatusin interfaceSlotManager- Parameters:
instanceId- identifying the task manager for which to report the slot statusslotReport- containing the status for all of its slots- Returns:
- true if the slot status has been updated successfully, otherwise false
-
freeSlot
Free the given slot from the given allocation. If the slot is still allocated by the given allocation id, then the slot will be freed.- Specified by:
freeSlotin interfaceSlotManager- Parameters:
slotId- identifying the slot to free, will be ignoredallocationId- with which the slot is presumably allocated
-
getNumberRegisteredSlots
public int getNumberRegisteredSlots()- Specified by:
getNumberRegisteredSlotsin interfaceSlotManager
-
getNumberRegisteredSlotsOf
- Specified by:
getNumberRegisteredSlotsOfin interfaceSlotManager
-
getNumberFreeSlots
public int getNumberFreeSlots()- Specified by:
getNumberFreeSlotsin interfaceSlotManager
-
getNumberFreeSlotsOf
- Specified by:
getNumberFreeSlotsOfin interfaceSlotManager
-
getRegisteredResource
- Specified by:
getRegisteredResourcein interfaceSlotManager
-
getRegisteredResourceOf
- Specified by:
getRegisteredResourceOfin interfaceSlotManager
-
getFreeResource
- Specified by:
getFreeResourcein interfaceSlotManager
-
getFreeResourceOf
- Specified by:
getFreeResourceOfin interfaceSlotManager
-
getAllocatedSlotsOf
- Specified by:
getAllocatedSlotsOfin interfaceSlotManager
-
getTaskManagerIdleSince
-