You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by hi...@apache.org on 2015/12/04 23:15:53 UTC

tez git commit: TEZ-2970. Re-localization in TezChild does not use correct UGI. (hitesh)

Repository: tez
Updated Branches:
  refs/heads/master 9109645e5 -> f23758643


TEZ-2970. Re-localization in TezChild does not use correct UGI. (hitesh)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/f2375864
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/f2375864
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/f2375864

Branch: refs/heads/master
Commit: f23758643f03147dced0b3fdfd11a58b89f83eb7
Parents: 9109645
Author: Hitesh Shah <hi...@apache.org>
Authored: Fri Dec 4 14:15:37 2015 -0800
Committer: Hitesh Shah <hi...@apache.org>
Committed: Fri Dec 4 14:15:37 2015 -0800

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../org/apache/tez/runtime/task/TezChild.java   | 36 ++++++++++++--------
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/f2375864/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a5db06d..07c2a91 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -9,6 +9,7 @@ INCOMPATIBLE CHANGES
   TEZ-2949. Allow duplicate dag names within session for Tez.
 
 ALL CHANGES:
+  TEZ-2970. Re-localization in TezChild does not use correct UGI.
   TEZ-2968. Counter limits exception causes AM to crash.
   TEZ-2960. Tez UI: Move hardcoded url namespace to the configuration file
   TEZ-2581. Umbrella for Tez Recovery Redesign
@@ -271,6 +272,7 @@ INCOMPATIBLE CHANGES
   TEZ-2949. Allow duplicate dag names within session for Tez.
 
 ALL CHANGES
+  TEZ-2970. Re-localization in TezChild does not use correct UGI.
   TEZ-2968. Counter limits exception causes AM to crash.
   TEZ-2947. Tez UI: Timeline, RM & AM requests gets into a consecutive loop in counters page without any delay
   TEZ-2949. Allow duplicate dag names within session for Tez.

http://git-wip-us.apache.org/repos/asf/tez/blob/f2375864/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java
index e9b48f4..784065a 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java
@@ -243,7 +243,7 @@ public class TezChild {
         FileSystem.clearStatistics();
 
         childUGI = handleNewTaskCredentials(containerTask, childUGI);
-        handleNewTaskLocalResources(containerTask);
+        handleNewTaskLocalResources(containerTask, childUGI);
         cleanupOnTaskChanged(containerTask);
 
         // Execute the Actual Task
@@ -314,26 +314,34 @@ public class TezChild {
    * @throws IOException
    * @throws TezException
    */
-  private void handleNewTaskLocalResources(ContainerTask containerTask) throws IOException,
-      TezException {
-    Map<String, TezLocalResource> additionalResources = containerTask.getAdditionalResources();
+  private void handleNewTaskLocalResources(ContainerTask containerTask,
+      UserGroupInformation ugi) throws IOException, TezException {
+
+    final Map<String, TezLocalResource> additionalResources = containerTask.getAdditionalResources();
     if (LOG.isDebugEnabled()) {
       LOG.debug("Additional Resources added to container: " + additionalResources);
     }
 
-
     if (additionalResources != null && !additionalResources.isEmpty()) {
       LOG.info("Localizing additional local resources for Task : " + additionalResources);
 
-      List<URL> downloadedUrls = RelocalizationUtils.processAdditionalResources(
-          Maps.transformValues(additionalResources, new Function<TezLocalResource, URI>() {
-            @Override
-            public URI apply(TezLocalResource input) {
-              return input.getUri();
-            }
-          }), defaultConf, workingDir);
-      RelocalizationUtils.addUrlsToClassPath(downloadedUrls);
-
+      try {
+        List<URL> downloadedUrls = ugi.doAs(new PrivilegedExceptionAction<List<URL>>() {
+          @Override
+          public List<URL> run() throws Exception {
+            return RelocalizationUtils.processAdditionalResources(
+                Maps.transformValues(additionalResources, new Function<TezLocalResource, URI>() {
+                  @Override
+                  public URI apply(TezLocalResource input) {
+                    return input.getUri();
+                  }
+                }), defaultConf, workingDir);
+          }
+        });
+        RelocalizationUtils.addUrlsToClassPath(downloadedUrls);
+      } catch (InterruptedException e) {
+        throw new TezException(e);
+      }
       LOG.info("Done localizing additional resources");
     }
   }