GJL commented on a change in pull request #10152: [FLINK-14466][runtime] Let 
YarnJobClusterEntrypoint use user code class loader
URL: https://github.com/apache/flink/pull/10152#discussion_r345799290
 
 

 ##########
 File path: 
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java
 ##########
 @@ -737,6 +738,19 @@ private ApplicationReport startAppMaster(
 
                addEnvironmentFoldersToShipFiles(systemShipFiles);
 
+               if (userJarInclusion == 
YarnConfigOptions.UserJarInclusion.DISABLED) {
+                       shipFiles.stream()
+                               .filter(File::isDirectory)
+                               .map(File::getName)
+                               .filter(name -> 
name.equals(DEFAULT_FLINK_USR_LIB_DIR))
+                               .findAny()
+                               .ifPresent(name -> {
 
 Review comment:
   This block of code looks like it belongs into a `checkState`. 
   Also, you can directly use `Stream#noneMatch(Predicate)` instead of 
`findAny().ifPresent(...)`.
   
   ```
        Preconditions.checkState(
                        userJarInclusion != 
YarnConfigOptions.UserJarInclusion.DISABLED || isUsrLibDirIncludedInShipFiles(),
                        "This is an illegal ship directory [...]", 
                        YarnConfigOptions.UserJarInclusion.DISABLED, 
                        ConfigConstants.DEFAULT_FLINK_USR_LIB_DIR);
   ```
   
   ```
        private boolean isUsrLibDirIncludedInShipFiles() {
                return shipFiles.stream()
                        .filter(File::isDirectory)
                        .map(File::getName)
                        .noneMatch(name -> 
name.equals(DEFAULT_FLINK_USR_LIB_DIR));
        }
   ```
   
   Disclaimer: I didn't test the above code.
   
   

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

Reply via email to