sv2000 commented on a change in pull request #3057: URL: https://github.com/apache/incubator-gobblin/pull/3057#discussion_r454053098
########## File path: gobblin-yarn/src/main/java/org/apache/gobblin/yarn/GobblinApplicationMaster.java ########## @@ -227,6 +227,8 @@ public static void main(String[] args) throws Exception { printUsage(options); System.exit(1); } + Config config = ConfigFactory.load(); Review comment: Can we replace the ConfigFactory.load() in line 240 with the config variable created here? ########## File path: gobblin-yarn/src/main/java/org/apache/gobblin/yarn/YarnHelixUtils.java ########## @@ -65,6 +71,27 @@ public static void writeTokenToFile(Token<? extends TokenIdentifier> token, Path credentials.writeTokenStorageFile(tokenFilePath, configuration); } + /** + * Update {@link Token} with the configured token path. + * + * @param config a {@link Config} object carrying Hadoop configuration properties and token path config + * @throws IOException + */ + public static void updateToken(Config config) throws IOException{ + FileSystem fs = GobblinClusterUtils.buildFileSystem(config, new Configuration()); + Path tokenPath = new Path(fs.getHomeDirectory(), + config.getString(GobblinYarnConfigurationKeys.APPLICATION_NAME_KEY) + Path.SEPARATOR + + GobblinYarnConfigurationKeys.TOKEN_FILE_NAME); + if(fs.exists(tokenPath)) { + Credentials credentials = Credentials.readTokenStorageFile(tokenPath, fs.getConf()); Review comment: Can lines 86-91 be refactored out into a separate addCredentials() method, which can be called also from YarnContainerSecurityManager? ---------------------------------------------------------------- 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: us...@infra.apache.org