Interface ResourceAllocationStrategy
- All Known Implementing Classes:
DefaultResourceAllocationStrategy
public interface ResourceAllocationStrategy
Strategy for allocating slots and task managers to fulfill the unfulfilled requirements.
-
Method Summary
Modifier and TypeMethodDescriptiontryFulfillRequirements(Map<org.apache.flink.api.common.JobID, Collection<ResourceRequirement>> missingResources, org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerResourceInfoProvider taskManagerResourceInfoProvider, BlockedTaskManagerChecker blockedTaskManagerChecker) Try to make an allocation decision to fulfill the resource requirements.tryReconcileClusterResources(org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerResourceInfoProvider taskManagerResourceInfoProvider) Try to make a decision to reconcile the cluster resources.
-
Method Details
-
tryFulfillRequirements
ResourceAllocationResult tryFulfillRequirements(Map<org.apache.flink.api.common.JobID, Collection<ResourceRequirement>> missingResources, org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerResourceInfoProvider taskManagerResourceInfoProvider, BlockedTaskManagerChecker blockedTaskManagerChecker) Try to make an allocation decision to fulfill the resource requirements. The strategy generates a series of actions to take, based on the current status.Notice: For performance considerations, modifications might be performed directly on the input arguments. If the arguments are reused elsewhere, please make a deep copy in advance.
- Parameters:
missingResources- resource requirements that are not yet fulfilled, indexed by jobIdtaskManagerResourceInfoProvider- provide the registered/pending resources of the current clusterblockedTaskManagerChecker- blocked task manager checker- Returns:
- a
ResourceAllocationResultbased on the current status, which contains whether the requirements can be fulfilled and the actions to take
-
tryReconcileClusterResources
ResourceReconcileResult tryReconcileClusterResources(org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerResourceInfoProvider taskManagerResourceInfoProvider) Try to make a decision to reconcile the cluster resources. This is more light weighted thantryFulfillRequirements(java.util.Map<org.apache.flink.api.common.JobID, java.util.Collection<org.apache.flink.runtime.slots.ResourceRequirement>>, org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerResourceInfoProvider, org.apache.flink.runtime.blocklist.BlockedTaskManagerChecker), only consider empty registered / pending workers and assume all requirements are fulfilled by registered / pending workers.- Parameters:
taskManagerResourceInfoProvider- provide the registered/pending resources of the current cluster- Returns:
- a
ResourceReconcileResultbased on the current status, which contains the actions to take
-