Sxnan commented on code in PR #298:
URL: https://github.com/apache/flink-agents/pull/298#discussion_r2485804817


##########
python/flink_agents/runtime/remote_execution_environment.py:
##########
@@ -269,6 +269,50 @@ def execute(self) -> None:
         self.__env.execute()
 
 
+    def __load_config_from_flink_conf_dir(self) -> None:
+        """Load agent configuration from FLINK_CONF_DIR if available."""
+        flink_conf_dir = os.environ.get("FLINK_CONF_DIR")
+        if flink_conf_dir is None:
+            return
+
+        # Try to find config file, with fallback to legacy name
+        config_path = self.__find_config_file(flink_conf_dir)
+
+        if config_path is None:
+            logging.error(f"Config file not found in {flink_conf_dir}")
+        else:
+            self.__config.load_from_file(str(config_path))
+
+    def __find_config_file(self, flink_conf_dir: str) -> Path | None:
+        """Find config file in the given directory, checking both new and 
legacy names.
+
+        Parameters
+        ----------
+        flink_conf_dir : str
+            Directory to search for config files.
+
+        Returns:
+        -------
+        Path | None
+            Path to the config file if found, None otherwise.
+        """
+        # Try primary config file name
+        primary_config_path = Path(flink_conf_dir).joinpath(_CONFIG_FILE_NAME)
+        if primary_config_path.exists():
+            return primary_config_path
+
+        # Try legacy config file name

Review Comment:
   Good catch!



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