Github user yanghua commented on a diff in the pull request:
https://github.com/apache/flink/pull/5593#discussion_r171187437
--- Diff:
flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java
---
@@ -979,6 +989,16 @@ public ApplicationReport startAppMaster(
appContext.setApplicationType("Apache Flink");
appContext.setAMContainerSpec(amContainer);
appContext.setResource(capability);
+
+ if (nodeLabel != null) {
+ try {
+ Method method =
appContext.getClass().getMethod("setNodeLabelExpression", String.class);
+ method.invoke(appContext, nodeLabel);
+ } catch (NoSuchMethodException e) {
+ LOG.warn("Ignoring node label setting because
the version of YARN does not support it");
+ }
+ }
--- End diff --
@tillrohrmann I know, I just find there is a inner static class
`ApplicationSubmissionContextReflector`, it uses reflection to set fields for
`ApplicationSubmissionContext` such as `setApplicationTags`. I think add this
code segment to this class and wrap it to a method named
`setApplicationNodeLabel` could be better.
What's your opinion?
---