Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-14187 FLIP-56 Dynamic Slot Allocation
  3. FLINK-14869

Force an extended resource to be null if it's value is 0

    XMLWordPrintableJSON

Details

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              xtsong Xintong Song
              zhuzh Zhu Zhu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: