public class DefaultResourceAllocationStrategy extends Object implements ResourceAllocationStrategy
ResourceAllocationStrategy
.
For each requirement, this strategy tries to fulfill it with any registered or pending resources (registered is prioritized). If a requirement cannot be fulfilled by any registered or pending resources, it allocates a new pending resource, with the pre-defined total and default slot resource profiles, thus all new pending resources should have the same profiles. A requirement is considered unfulfillable if it is not fulfilled by any registered or pending resources and cannot fit into the pre-defined total resource profile.
Note: This strategy tries to find a feasible allocation result, rather than an optimal one (in terms of resource utilization). It also does not guarantee always finding a feasible solution when exists.
Note: The current implementation of this strategy is non-optimal, in terms of computation efficiency. In the worst case, for each distinctly profiled requirement it checks all registered and pending resources. Further optimization requires complex data structures for ordering multidimensional resource profiles. The complexity is not necessary.
Constructor and Description |
---|
DefaultResourceAllocationStrategy(ResourceProfile totalResourceProfile,
int numSlotsPerWorker,
TaskManagerOptions.TaskManagerLoadBalanceMode taskManagerLoadBalanceMode,
Time taskManagerTimeout,
int redundantTaskManagerNum,
CPUResource minTotalCPU,
MemorySize minTotalMemory) |
Modifier and Type | Method and Description |
---|---|
ResourceAllocationResult |
tryFulfillRequirements(Map<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.
|
ResourceReconcileResult |
tryReconcileClusterResources(org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerResourceInfoProvider taskManagerResourceInfoProvider)
Try to make a decision to reconcile the cluster resources.
|
public DefaultResourceAllocationStrategy(ResourceProfile totalResourceProfile, int numSlotsPerWorker, TaskManagerOptions.TaskManagerLoadBalanceMode taskManagerLoadBalanceMode, Time taskManagerTimeout, int redundantTaskManagerNum, CPUResource minTotalCPU, MemorySize minTotalMemory)
public ResourceAllocationResult tryFulfillRequirements(Map<JobID,Collection<ResourceRequirement>> missingResources, org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerResourceInfoProvider taskManagerResourceInfoProvider, BlockedTaskManagerChecker blockedTaskManagerChecker)
ResourceAllocationStrategy
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.
tryFulfillRequirements
in interface ResourceAllocationStrategy
missingResources
- resource requirements that are not yet fulfilled, indexed by jobIdtaskManagerResourceInfoProvider
- provide the registered/pending resources of the
current clusterblockedTaskManagerChecker
- blocked task manager checkerResourceAllocationResult
based on the current status, which contains
whether the requirements can be fulfilled and the actions to takepublic ResourceReconcileResult tryReconcileClusterResources(org.apache.flink.runtime.resourcemanager.slotmanager.TaskManagerResourceInfoProvider taskManagerResourceInfoProvider)
ResourceAllocationStrategy
ResourceAllocationStrategy.tryFulfillRequirements(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.tryReconcileClusterResources
in interface ResourceAllocationStrategy
taskManagerResourceInfoProvider
- provide the registered/pending resources of the
current clusterResourceReconcileResult
based on the current status, which contains the
actions to takeCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.