Repository: tez
Updated Branches:
  refs/heads/branch-0.7 e3f10d2e0 -> 42a63fd20


TEZ-2787. Tez AM should have java.io.tmpdir=./tmp to be consistent with tasks 
(jeagles)

(cherry picked from commit 46decf303a224715a2fbf47b7d4f9463ca8a52c7)


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

Branch: refs/heads/branch-0.7
Commit: 42a63fd20c2e33a5f7375c26fd6cb391cb838484
Parents: e3f10d2
Author: Jonathan Eagles <[email protected]>
Authored: Fri Sep 11 13:42:43 2015 -0500
Committer: Jonathan Eagles <[email protected]>
Committed: Fri Sep 11 13:47:32 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 .../java/org/apache/tez/client/TezClientUtils.java   |  7 +++++--
 .../org/apache/tez/client/TestTezClientUtils.java    | 15 ++++++++++-----
 3 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/42a63fd2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d907ede..bccbda4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@ Release 0.7.1: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES:
+  TEZ-2787. Tez AM should have java.io.tmpdir=./tmp to be consistent with tasks
   TEZ-2780. Tez UI: Update All Tasks page while in progress
   TEZ-2792. addendum fix build failure for java 6
   TEZ-2792. Add AM web service API for tasks

http://git-wip-us.apache.org/repos/asf/tez/blob/42a63fd2/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java 
b/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
index 3223f97..f0e67c7 100644
--- a/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
+++ b/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
@@ -987,9 +987,12 @@ public class TezClientUtils {
   static String constructAMLaunchOpts(TezConfiguration tezConf, Resource 
capability) {
     String defaultOpts = 
tezConf.get(TezConfiguration.TEZ_AM_LAUNCH_CLUSTER_DEFAULT_CMD_OPTS,
         TezConfiguration.TEZ_AM_LAUNCH_CLUSTER_DEFAULT_CMD_OPTS_DEFAULT);
-    String amOpts = "";
+    Path tmpDir = new Path(Environment.PWD.$(),
+        YarnConfiguration.DEFAULT_CONTAINER_TEMP_DIR);
+    String amOpts = "-Djava.io.tmpdir=" + tmpDir + " ";
+
     if (defaultOpts != null && !defaultOpts.isEmpty()) {
-      amOpts = defaultOpts + " ";
+      amOpts = amOpts + defaultOpts + " ";
     }
     amOpts = amOpts + tezConf.get(TezConfiguration.TEZ_AM_LAUNCH_CMD_OPTS,
         TezConfiguration.TEZ_AM_LAUNCH_CMD_OPTS_DEFAULT);

http://git-wip-us.apache.org/repos/asf/tez/blob/42a63fd2/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java
----------------------------------------------------------------------
diff --git 
a/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java 
b/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java
index 00eb876..0800085 100644
--- a/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java
+++ b/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java
@@ -49,6 +49,7 @@ import org.apache.hadoop.io.DataInputByteBuffer;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.yarn.api.ApplicationConstants;
+import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
@@ -323,6 +324,9 @@ public class TestTezClientUtils {
 
   @Test(timeout = 5000)
   public void testAMCommandOpts() {
+    Path tmpDir = new Path(Environment.PWD.$(),
+        YarnConfiguration.DEFAULT_CONTAINER_TEMP_DIR);
+    String tmpOpts = "-Djava.io.tmpdir=" + tmpDir;
     TezConfiguration tezConf = new TezConfiguration();
     String amCommandOpts = "-Xmx 200m -Dtest.property";
     tezConf.set(TezConfiguration.TEZ_AM_LAUNCH_CMD_OPTS, amCommandOpts);
@@ -330,8 +334,9 @@ public class TestTezClientUtils {
     // Test1: Rely on defaults for cluster-default opts
     String amOptsConstructed =
         TezClientUtils.constructAMLaunchOpts(tezConf, 
Resource.newInstance(1024, 1));
-    assertEquals(
-        TezConfiguration.TEZ_AM_LAUNCH_CLUSTER_DEFAULT_CMD_OPTS_DEFAULT + " " 
+ amCommandOpts,
+    assertEquals(tmpOpts + " "
+        + TezConfiguration.TEZ_AM_LAUNCH_CLUSTER_DEFAULT_CMD_OPTS_DEFAULT + " "
+        + amCommandOpts,
         amOptsConstructed);
 
     // Test2: Setup cluster-default command opts explicitly
@@ -340,7 +345,7 @@ public class TestTezClientUtils {
     tezConf.set(TezConfiguration.TEZ_AM_LAUNCH_CLUSTER_DEFAULT_CMD_OPTS, 
clusterDefaultCommandOpts);
     amOptsConstructed =
         TezClientUtils.constructAMLaunchOpts(tezConf, 
Resource.newInstance(1024, 1));
-    assertEquals(clusterDefaultCommandOpts + " " + amCommandOpts, 
amOptsConstructed);
+    assertEquals(tmpOpts + " " + clusterDefaultCommandOpts + " " + 
amCommandOpts, amOptsConstructed);
 
 
     // Test3: Don't setup Xmx explicitly
@@ -351,7 +356,7 @@ public class TestTezClientUtils {
         TezClientUtils.constructAMLaunchOpts(tezConf, 
Resource.newInstance(1024, 1));
     // It's OK for the Xmx value to show up before cluster default options, 
since Xmx will not be replaced if it already exists.
     assertEquals(
-        " -Xmx" + ((int) (1024 * factor)) + "m" + " " + 
clusterDefaultCommandOpts + " " +
+        " -Xmx" + ((int) (1024 * factor)) + "m" + " " + tmpOpts + " " + 
clusterDefaultCommandOpts + " " +
             amCommandOpts,
         amOptsConstructed);
 
@@ -361,7 +366,7 @@ public class TestTezClientUtils {
     tezConf.set(TezConfiguration.TEZ_AM_LAUNCH_CLUSTER_DEFAULT_CMD_OPTS, 
clusterDefaultCommandOpts);
     amOptsConstructed =
         TezClientUtils.constructAMLaunchOpts(tezConf, 
Resource.newInstance(1024, 1));
-    assertEquals(clusterDefaultCommandOpts + " " + amCommandOpts, 
amOptsConstructed);
+    assertEquals(tmpOpts + " " + clusterDefaultCommandOpts + " " + 
amCommandOpts, amOptsConstructed);
   }
 
   @Test(timeout = 5000)

Reply via email to