xintongsong commented on a change in pull request #9910: [FLINK-14405][runtime]
Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory
setups.
URL: https://github.com/apache/flink/pull/9910#discussion_r335790615
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
##########
@@ -51,11 +52,19 @@
private static final long serialVersionUID = 1L;
- /** A ResourceProfile that indicates an unknown set of resources. */
+ /**
+ * A ResourceProfile that indicates an unknown resource requirement.
+ * This is mainly used for describing resource requirements that the
exact amount of resource needed is not specified.
+ * It can also be used for describing remaining resource of a multi
task slot that contains tasks with unknown resource requirements.
+ * It should not used for describing total resource of a task executor
/ slot, which should always be specific.
+ * */
public static final ResourceProfile UNKNOWN = new ResourceProfile();
- /** ResourceProfile which matches any other ResourceProfile. */
- public static final ResourceProfile ANY = new
ResourceProfile(Double.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
Collections.emptyMap());
+ /**
+ * A ResourceProfile that indicates infinite resource that matches any
resource requirement, for testability purpose only.
+ * */
+ @VisibleForTesting
+ public static final ResourceProfile INFINITE = new
ResourceProfile(Double.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
Collections.emptyMap());
Review comment:
I think renaming `ANY` to `INFINITE` is indeed helpful. `ANY` is ambiguous.
People may misunderstand this as "requesting a slot with any resource", and
thus misuse it for requirements. I see this many times in maintaining our
internal version, and whenever I correct them the new misusage comes out after
a while.
As for `UNKNOWN`, I was also considering renaming it to
`UNKNOWN_REQUIREMENT`. Then I discovered that there's one case that it's not
describing the resource requirement, but describing the unknown state of a
slot. That is, as I explained in the javadocs, for describing remaining
resources of a slot that already contains tasks with unknown resource
requirements in slot sharing scenarios (`MultiTaskSlot#reservedResources`).
----------------------------------------------------------------
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