You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/08/10 18:46:12 UTC

[GitHub] [incubator-gobblin] jhsenjaliya commented on a change in pull request #3074: GOBBLIN-1228: Do not localize token file on new TaskRunner launch

jhsenjaliya commented on a change in pull request #3074:
URL: https://github.com/apache/incubator-gobblin/pull/3074#discussion_r468106247



##########
File path: gobblin-yarn/src/main/java/org/apache/gobblin/yarn/YarnHelixUtils.java
##########
@@ -72,19 +73,22 @@ public static void writeTokenToFile(Token<? extends TokenIdentifier> token, Path
   }
 
   /**
-   * Update {@link Token} with token file in resources.
+   * Update {@link Token} with token file localized by NM.
    *
-   * @param
+   * @param tokenFileName name of the token file
    * @throws IOException
    */
-  public static void updateToken() throws IOException{
-    File tokenFile = new File(YarnHelixUtils.class.getClassLoader().getResource(GobblinYarnConfigurationKeys.TOKEN_FILE_NAME).getFile());
-    if(tokenFile.exists()) {
-      Credentials credentials = Credentials.readTokenStorageFile(tokenFile, new Configuration());
-      for (Token<? extends TokenIdentifier> token : credentials.getAllTokens()) {
-        LOGGER.info("updating " + token.getKind() + " " + token.getService());
+  public static void updateToken(String tokenFileName) throws IOException{
+    URL tokenFileUrl = YarnHelixUtils.class.getClassLoader().getResource(tokenFileName);
+    if (tokenFileUrl != null) {

Review comment:
       +1 on NPE check, this was an issue on previous code. Thanks




----------------------------------------------------------------
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:
users@infra.apache.org