You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Samrat002 (via GitHub)" <gi...@apache.org> on 2025/01/02 08:42:11 UTC

Re: [PR] [FLINK-22091][yarn] Make Flink on YARN honor env.java.home [flink]

Samrat002 commented on code in PR #25877:
URL: https://github.com/apache/flink/pull/25877#discussion_r1900643543


##########
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/ContaineredTaskManagerParameters.java:
##########
@@ -90,6 +93,12 @@ public static ContaineredTaskManagerParameters create(
             }
         }
 
+        // set JAVA_HOME
+        String javaHome = config.get(CoreOptions.FLINK_JAVA_HOME);
+        if (!javaHome.isEmpty()) {

Review Comment:
   I think `config.get(CoreOptions.FLINK_JAVA_HOME)` will return `""` if the `env.java.home` is not configured. 
   
   Can you add a negative test case to validate that the default Java home is picked when `CoreOptions.FLINK_JAVA_HOME` is not set? 
   



##########
flink-core/src/main/java/org/apache/flink/configuration/CoreOptions.java:
##########
@@ -225,6 +225,17 @@ public static String[] mergeListsToArray(List<String> base, List<String> append)
     //  process parameters
     // ------------------------------------------------------------------------
 
+    public static final ConfigOption<String> FLINK_JAVA_HOME =
+            ConfigOptions.key("env.java.home")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription(
+                            Description.builder()
+                                    .text(
+                                            "Location where Java is installed. If not specified,"
+                                                    + " Flink will use your default Java installation.")
+                                    .build());
+

Review Comment:
   ```suggestion
       public static final ConfigOption<String> FLINK_JAVA_HOME =
               ConfigOptions.key("env.java.home")
                       .stringType()
                       .noDefaultValue()
                       .withDescription(
                               Description.builder()
                                       .text(
                                               "Location where Java is installed. If not specified,"
                                                       + " Flink will use your default Java installation.")
                                       .build());
   
   ```
   
   changing to noDefaultValue() 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org