igalshilman commented on a change in pull request #27: [FLINK-16149][core] Set
configurations using StreamExecutionEnvironment#getConfiguration
URL: https://github.com/apache/flink-statefun/pull/27#discussion_r382100607
##########
File path:
statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/StatefulFunctionsJob.java
##########
@@ -17,59 +17,62 @@
*/
package org.apache.flink.statefun.flink.core;
+import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.Map;
import java.util.Objects;
import org.apache.flink.api.java.utils.ParameterTool;
+import org.apache.flink.configuration.ConfigConstants;
import org.apache.flink.configuration.Configuration;
+import org.apache.flink.configuration.GlobalConfiguration;
import
org.apache.flink.runtime.execution.librarycache.FlinkUserCodeClassLoaders;
-import org.apache.flink.statefun.flink.core.common.ConfigurationUtil;
import org.apache.flink.statefun.flink.core.translation.FlinkUniverse;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+@SuppressWarnings("JavaReflectionMemberAccess")
public class StatefulFunctionsJob {
+ private static final String CONFIG_DIRECTORY_FALLBACK_1 = "../conf";
+ private static final String CONFIG_DIRECTORY_FALLBACK_2 = "conf";
+
public static void main(String... args) throws Exception {
ParameterTool parameterTool = ParameterTool.fromArgs(args);
- Configuration configuration = parameterTool.getConfiguration();
+ Map<String, String> globalConfigurations = parameterTool.toMap();
+
+ String configDirectory = getConfigurationDirectoryFromEnv();
+ Configuration flinkConf =
GlobalConfiguration.loadConfiguration(configDirectory);
+ StatefulFunctionsConfig stateFunConfig = new
StatefulFunctionsConfig(flinkConf);
+ stateFunConfig.setGlobalConfigurations(globalConfigurations);
+ stateFunConfig.setProvider(new
StatefulFunctionsUniverses.ClassPathUniverseProvider());
- main(configuration);
+ main(stateFunConfig, new Configuration());
Review comment:
The source of my confusion is the `new Configuration()`,
it is empty, while we can use the one that you've just obtained from
`flink-conf.yaml`.
The reason I'm asking is that down the line you'll be calling:
`env.configure(..)` - wouldn't it be better to pass the configuration parsed
from flink-conf ?
----------------------------------------------------------------
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