Zhu Zhu created FLINK-14869:
-------------------------------
Summary: Force an extended resource to be null if it's value is 0
Key: FLINK-14869
URL:
https://issues.apache.org/jira/browse/FLINK-14869 Project: Flink
Issue Type: Improvement
Components: Runtime / Coordination
Reporter: Zhu Zhu
{{Resource}} accepts value 0 at the moment because 0 {{CPUResource}} is used in production to indicate no strict requirement for CPU cores.
However, keeping extended resources with value 0 is causing troubles.
e.g. There can be 2 ResourceSpecs, rs1 and rs2, with the same resources except that rs1 contains a GPUResource with value 0 while rs2 does not contains a specified GPUResource. In this case, rs1.equals(rs2)==false and rs1.isLessOrEqualThan(rs2)==false, which is not correct.
Accepting both 0 and null extended resources is also making things more complex, since we need to consider it in all comparisons(equals/lessThanOrEqual/isMatch) and aggregations(merge/subtract).
To be simple, I'd propose to change it like this: in ResourceSpec/ResourceProfile we only keep extended resource with positive values. To be specific, if in the constructors of ResourceSpec/ResourceProfile, a specified extended resource is found to be 0, it must be dropped so that 0 resource would always be null.
cc [~chesnay]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)