wangyang0918 commented on a change in pull request #10143:
[FLINK-13184]Starting a TaskExecutor blocks the YarnResourceManager's main
thread
URL: https://github.com/apache/flink/pull/10143#discussion_r344666748
##########
File path: flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java
##########
@@ -641,4 +610,32 @@ static void require(boolean condition, String message,
Object... values) {
}
}
+ /**
+ * Get dynamic properties based on two Flink configuration. If base
config does not contain and target config
+ * contains the key or the value is different, it should be added to
results. Otherwise, if the base config contains
+ * and target config does not contain the key, it will be ignored.
+ * @param baseConfig The base configuration.
+ * @param targetConfig The target configuration.
+ * @return Dynamic properties as string, separated by space.
+ */
+ static String getDynamicProperties(
+ org.apache.flink.configuration.Configuration baseConfig,
+ org.apache.flink.configuration.Configuration targetConfig) {
+
+ String[] newAddedConfigs =
targetConfig.keySet().stream().flatMap(
+ (String key) -> {
+ final String baseValue =
baseConfig.getString(ConfigOptions.key(key).stringType().noDefaultValue());
+ final String targetValue =
targetConfig.getString(ConfigOptions.key(key).stringType().noDefaultValue());
+
+ if (!baseConfig.keySet().contains(key) ||
!baseValue.equals(targetValue)) {
+ return Stream.of("-" +
CommandLineOptions.DYNAMIC_PROPERTY_OPTION.getOpt() + key +
+
CommandLineOptions.DYNAMIC_PROPERTY_OPTION.getValueSeparator() + targetValue);
+ } else {
+ return Stream.empty();
+ }
+ })
+ .toArray(String[]::new);
+ return
org.apache.commons.lang3.StringUtils.join(newAddedConfigs, " ");
Review comment:
OK. I will use `java.lang.String.join` instead.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services