huwh commented on code in PR #23201:
URL: https://github.com/apache/flink/pull/23201#discussion_r1349610727
##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/DefaultResourceAllocationStrategy.java:
##########
@@ -347,10 +367,26 @@ && canFulfillRequirement(effectiveProfile,
remainResource)) {
}
}
- private void tryFulFillRedundantResources(
- ResourceProfile requiredRedundantResource,
+ private boolean isRequiredResourcesFulfilled(
+ ResourceProfile availableResourceProfile, ResourceProfile
totalResourceProfile) {
Review Comment:
We already have a class variable `totalResourceProfile`, It's better to not
use this in method arguments.
```suggestion
ResourceProfile resourceAvailable, ResourceProfile
resourceInTotal) {
```
##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/DefaultResourceAllocationStrategy.java:
##########
@@ -347,10 +367,26 @@ && canFulfillRequirement(effectiveProfile,
remainResource)) {
}
}
- private void tryFulFillRedundantResources(
- ResourceProfile requiredRedundantResource,
+ private boolean isRequiredResourcesFulfilled(
+ ResourceProfile availableResourceProfile, ResourceProfile
totalResourceProfile) {
+ return isRedundantResourcesFulfilled(availableResourceProfile)
+ && isMinRequiredResourcesFulfilled(totalResourceProfile);
+ }
+
+ private boolean isRedundantResourcesFulfilled(ResourceProfile
availableResourceProfile) {
Review Comment:
ditto
##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/DefaultResourceAllocationStrategy.java:
##########
@@ -347,10 +367,26 @@ && canFulfillRequirement(effectiveProfile,
remainResource)) {
}
}
- private void tryFulFillRedundantResources(
- ResourceProfile requiredRedundantResource,
+ private boolean isRequiredResourcesFulfilled(
+ ResourceProfile availableResourceProfile, ResourceProfile
totalResourceProfile) {
+ return isRedundantResourcesFulfilled(availableResourceProfile)
+ && isMinRequiredResourcesFulfilled(totalResourceProfile);
+ }
+
+ private boolean isRedundantResourcesFulfilled(ResourceProfile
availableResourceProfile) {
+ return availableResourceProfile.allFieldsNoLessThan(
+ totalResourceProfile.multiply(redundantTaskManagerNum));
+ }
+
+ private boolean isMinRequiredResourcesFulfilled(ResourceProfile
totalResourceProfile) {
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]