tillrohrmann commented on a change in pull request #12315:
URL: https://github.com/apache/flink/pull/12315#discussion_r429966710



##########
File path: 
flink-yarn/src/main/java/org/apache/flink/yarn/ResourceInformationReflector.java
##########
@@ -151,7 +151,9 @@ void setResourceInformationUnSafe(Object resource, String 
resourceName, long amo
                        for (int i = 2; i < externalResourcesInfo.length; i++) {
                                final String name = (String) 
resourceInformationGetNameMethod.invoke(externalResourcesInfo[i]);
                                final long value = (long) 
resourceInformationGetValueMethod.invoke(externalResourcesInfo[i]);
-                               externalResources.put(name, value);
+                               if (value > 0) {
+                                       externalResources.put(name, value);
+                               }

Review comment:
       I think the proper solution is to enforce this invariant in the 
`InternalContainerResource` constructor (filtering out entries with a value of 
`0` or to adapt the `equals` method to not check entries with a value of `0`). 
Otherwise we might run into the situation that sometime in the future when the 
user can specify the GPU constraints on an operator and he sets it to `0` that 
the resources won't match.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to