StephanEwen commented on a change in pull request #8704: [FLINK-12812][runtime]
Set resource profiles for task slots
URL: https://github.com/apache/flink/pull/8704#discussion_r300046813
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
##########
@@ -284,12 +301,39 @@ else if (obj != null && obj.getClass() ==
ResourceProfile.class) {
return this.cpuCores == that.cpuCores &&
this.heapMemoryInMB ==
that.heapMemoryInMB &&
this.directMemoryInMB ==
that.directMemoryInMB &&
+ this.nativeMemoryInMB ==
that.nativeMemoryInMB &&
this.networkMemoryInMB ==
that.networkMemoryInMB &&
+ this.managedMemoryInMB ==
that.managedMemoryInMB &&
Objects.equals(extendedResources,
that.extendedResources);
}
return false;
}
+ public boolean approximate(ResourceProfile that) {
+ if (that == null) {
+ return false;
+ }
+ if (Math.abs(this.cpuCores - that.cpuCores) > 1e-6f) {
Review comment:
All these values seem very magic. Is this approximate matching needed?
Does this have to do with around rounding errors during the profile
computation?
Common patterns for magic numbers is to put them into constants and comment
on why this is a good magic value.
Could you explain (and add a comment) why this is needed? I would assume
that is the user/planner requests exactly 64MB of managed memory and
parameterizes the algorithms to use that, then 62MB would not be enough.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services