semlanghi commented on code in PR #1337:
URL: https://github.com/apache/flink-agents/pull/1337#discussion_r4414193623


##########
runtime/src/main/java/org/apache/flink/agents/runtime/env/RemoteExecutionEnvironment.java:
##########
@@ -119,10 +127,34 @@ public static AgentConfiguration 
loadAgentConfiguration(String configDir) {
             if (configDir == null) {
                 return new AgentConfiguration();
             }
-            final Map<String, Object> configData =
-                    (Map<String, Object>)
-                            YamlParserUtils.loadYamlFile(new File(configDir, 
FLINK_CONF_FILENAME))
-                                    .getOrDefault("agent", new HashMap<>());
+            File configFile = new File(configDir, FLINK_CONF_FILENAME);
+            if (!configFile.exists()) {
+                File legacyConfigFile = new File(configDir, 
LEGACY_FLINK_CONF_FILENAME);
+                if (legacyConfigFile.exists()) {
+                    LOG.warn(
+                            "{} not found in {}, using legacy config file {}",
+                            FLINK_CONF_FILENAME,
+                            configDir,
+                            LEGACY_FLINK_CONF_FILENAME);
+                    configFile = legacyConfigFile;
+                }
+            }
+
+            final Map<String, Object> yaml = 
YamlParserUtils.loadYamlFile(configFile);

Review Comment:
   @wenjin272 one quick question on this: here the alignment with Python might 
go in opposite direction, as at the moment with Python the parsing is through 
PyYAML and one of the tests covers a `agent:` nested block 
(https://github.com/apache/flink-agents/blob/32aa6c86504a62b9dd7321f755f849fc16e1ac2d/python/flink_agents/runtime/tests/test_remote_execution_environment.py#L51)
 for flink 2.3 tests. Question is: how should we behave: those nested blocks 
should be supported only in flink 2.x? This would mean changing also the 
parsing method depending ont he version right? 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to