KarmaGYZ commented on a change in pull request #11854: URL: https://github.com/apache/flink/pull/11854#discussion_r413645612
########## File path: flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManager.java ########## @@ -495,6 +502,32 @@ public void onStopContainerError(ContainerId containerId, Throwable throwable) { // Utility methods // ------------------------------------------------------------------------ + private void setExternalResourceRequestIfPossible(Map<String, Long> externalResources) throws ResourceManagerException { + for (Map.Entry<String, Long> externalResource: externalResources.entrySet()) { + if (externalResource.getValue() == 0) { + continue; + } + + if (!isYarnResourceTypesAvailable()) { + throw new ResourceManagerException("Could not request extended resource because the underlying YARN does not support it."); + } + + try { + final Class<?> resourceInfoClass = Class.forName(RESOURCE_INFO_CLASS); + final Method setResourceInfoMethod = Resource.class.getMethod("setResourceInformation", String.class, resourceInfoClass); + final Method resourceInfoNewInstance = resourceInfoClass.getMethod("newInstance", String.class, long.class); + setResourceInfoMethod.invoke( + this.resource, + externalResource.getKey(), + resourceInfoNewInstance.invoke(null, externalResource.getKey(), externalResource.getValue())); + log.info("Successfully request the external resource {} with amount {}.", externalResource.getKey(), externalResource.getValue()); + + } catch (Exception e) { + throw new ResourceManagerException("Error in setting the external resource.", e); + } Review comment: In 2.10+ and 3.1+ the external resource is supported. ---------------------------------------------------------------- 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