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 `{}`
---