[ 
https://issues.apache.org/jira/browse/FLINK-8340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16313168#comment-16313168
 ] 

ASF GitHub Bot commented on FLINK-8340:
---------------------------------------

Github user GJL commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5226#discussion_r159874411
  
    --- Diff: 
flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java ---
    @@ -183,93 +204,43 @@ public FlinkYarnSessionCli(String shortPrefix, String 
longPrefix, boolean accept
                allOptions.addOption(applicationId);
                allOptions.addOption(zookeeperNamespace);
                allOptions.addOption(flip6);
    -   }
     
    -   /**
    -    * Tries to load a Flink Yarn properties file and returns the Yarn 
application id if successful.
    -    * @param cmdLine The command-line parameters
    -    * @param flinkConfiguration The flink configuration
    -    * @return Yarn application id or null if none could be retrieved
    -    */
    -   private String loadYarnPropertiesFile(CommandLine cmdLine, 
Configuration flinkConfiguration) {
    +           // try loading a potential yarn properties file
    +           final File yarnPropertiesLocation = 
getYarnPropertiesLocation(configuration.getString(YarnConfigOptions.PROPERTIES_FILE_LOCATION));
     
    -           String jobManagerOption = 
cmdLine.getOptionValue(ADDRESS_OPTION.getOpt(), null);
    -           if (jobManagerOption != null) {
    -                   // don't resume from properties file if a JobManager 
has been specified
    -                   return null;
    -           }
    +           yarnPropertiesFile = new Properties();
     
    -           for (Option option : cmdLine.getOptions()) {
    -                   if (allOptions.hasOption(option.getOpt())) {
    -                           if (!option.getOpt().equals(detached.getOpt())) 
{
    -                                   // don't resume from properties file if 
yarn options have been specified
    -                                   return null;
    -                           }
    -                   }
    -           }
    -
    -           // load the YARN properties
    -           File propertiesFile = 
getYarnPropertiesLocation(flinkConfiguration);
    -           if (!propertiesFile.exists()) {
    -                   return null;
    -           }
    -
    -           logAndSysout("Found YARN properties file " + 
propertiesFile.getAbsolutePath());
    +           if (yarnPropertiesLocation.exists()) {
    +                   LOG.info("Found Yarn properties file under " + 
yarnPropertiesLocation.getAbsolutePath() + '.');
    --- End diff --
    
    nit: slf4j placeholders can be used `{}`


> Do not pass Configuration and configuration directory to CustomCommandLine 
> methods
> ----------------------------------------------------------------------------------
>
>                 Key: FLINK-8340
>                 URL: https://issues.apache.org/jira/browse/FLINK-8340
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Client
>    Affects Versions: 1.5.0
>            Reporter: Till Rohrmann
>            Assignee: Till Rohrmann
>              Labels: flip-6
>             Fix For: 1.5.0
>
>
> Currently, all methods in {{CustomCommandLine}} need a {{Configuration}} and 
> sometimes the configuration directory. Since these values should not change 
> over the lifetime of the {{CustomCommandLine}} we should pass them as a 
> constructor argument instead of a method argument.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to