apex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pra...@apache.org
Subject incubator-apex-core git commit: APEXCORE-352 removed all hardcoded tmp directory locations
Date Wed, 24 Feb 2016 22:06:22 GMT
Repository: incubator-apex-core
Updated Branches:
  refs/heads/release-3.3 4fc3e26ee -> 3b01d9900


APEXCORE-352 removed all hardcoded tmp directory locations


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/commit/3b01d990
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/3b01d990
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/3b01d990

Branch: refs/heads/release-3.3
Commit: 3b01d9900e3bf741e2418918baa93bf82fabf89b
Parents: 4fc3e26
Author: David Yan <david@datatorrent.com>
Authored: Tue Feb 23 18:20:17 2016 -0800
Committer: David Yan <david@datatorrent.com>
Committed: Tue Feb 23 18:22:24 2016 -0800

----------------------------------------------------------------------
 engine/src/main/java/com/datatorrent/stram/StramClient.java     | 2 +-
 engine/src/main/java/com/datatorrent/stram/cli/DTCli.java       | 2 +-
 .../src/main/java/com/datatorrent/stram/client/AppPackage.java  | 5 +++--
 .../main/java/com/datatorrent/stram/client/ConfigPackage.java   | 3 ++-
 .../java/com/datatorrent/stram/client/StramClientUtils.java     | 3 ++-
 5 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/3b01d990/engine/src/main/java/com/datatorrent/stram/StramClient.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/StramClient.java b/engine/src/main/java/com/datatorrent/stram/StramClient.java
index 046a56c..e16afe9 100644
--- a/engine/src/main/java/com/datatorrent/stram/StramClient.java
+++ b/engine/src/main/java/com/datatorrent/stram/StramClient.java
@@ -576,7 +576,7 @@ public class StramClient
       vargs.add("-Djava.io.tmpdir=" + tmpDir);
       vargs.add("-Xmx" + (amMemory * 3 / 4) + "m");
       vargs.add("-XX:+HeapDumpOnOutOfMemoryError");
-      vargs.add("-XX:HeapDumpPath=/tmp/dt-heap-" + appId.getId() + ".bin");
+      vargs.add("-XX:HeapDumpPath=" + System.getProperty("java.io.tmpdir") + "/dt-heap-"
+ appId.getId() + ".bin");
       vargs.add("-Dhadoop.root.logger=" + (dag.isDebug() ? "DEBUG" : "INFO") + ",RFA");
       vargs.add("-Dhadoop.log.dir=" + ApplicationConstants.LOG_DIR_EXPANSION_VAR);
       vargs.add(String.format("-D%s=%s", StreamingContainer.PROP_APP_PATH, dag.assertAppPath()));

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/3b01d990/engine/src/main/java/com/datatorrent/stram/cli/DTCli.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/cli/DTCli.java b/engine/src/main/java/com/datatorrent/stram/cli/DTCli.java
index 0bd20fa..e5e3027 100644
--- a/engine/src/main/java/com/datatorrent/stram/cli/DTCli.java
+++ b/engine/src/main/java/com/datatorrent/stram/cli/DTCli.java
@@ -2920,7 +2920,7 @@ public class DTCli
 
   private File copyToLocal(String[] files) throws IOException
   {
-    File tmpDir = new File("/tmp/datatorrent/" + ManagementFactory.getRuntimeMXBean().getName());
+    File tmpDir = new File(System.getProperty("java.io.tmpdir") + "/datatorrent/" + ManagementFactory.getRuntimeMXBean().getName());
     tmpDir.mkdirs();
     for (int i = 0; i < files.length; i++) {
       try {

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/3b01d990/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java b/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java
index 86ca915..ada57e5 100644
--- a/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java
+++ b/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java
@@ -21,6 +21,7 @@ package com.datatorrent.stram.client;
 import com.datatorrent.stram.client.StramAppLauncher.AppFactory;
 import com.datatorrent.stram.plan.logical.LogicalPlan;
 import java.io.*;
+import java.nio.file.Files;
 import java.util.*;
 import java.util.jar.*;
 import net.lingala.zip4j.core.ZipFile;
@@ -120,8 +121,8 @@ public class AppPackage extends JarFile
       FileUtils.forceMkdir(contentFolder);
       cleanOnClose = false;
     } else {
-      cleanOnClose =  true;
-      contentFolder = new File("/tmp/dt-appPackage-" + Long.toString(System.nanoTime()));
+      cleanOnClose = true;
+      contentFolder = Files.createTempDirectory("dt-appPackage-").toFile();
     }
 
     Manifest manifest = getManifest();

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/3b01d990/engine/src/main/java/com/datatorrent/stram/client/ConfigPackage.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/client/ConfigPackage.java b/engine/src/main/java/com/datatorrent/stram/client/ConfigPackage.java
index 185cb7a..9ccc970 100644
--- a/engine/src/main/java/com/datatorrent/stram/client/ConfigPackage.java
+++ b/engine/src/main/java/com/datatorrent/stram/client/ConfigPackage.java
@@ -19,6 +19,7 @@
 package com.datatorrent.stram.client;
 
 import java.io.*;
+import java.nio.file.Files;
 import java.util.*;
 import java.util.jar.*;
 import net.lingala.zip4j.core.ZipFile;
@@ -96,7 +97,7 @@ public class ConfigPackage extends JarFile implements Closeable
     if (zipFile.isEncrypted()) {
       throw new ZipException("Encrypted conf package not supported yet");
     }
-    File newDirectory = new File("/tmp/dt-configPackage-" + Long.toString(System.nanoTime()));
+    File newDirectory = Files.createTempDirectory("dt-configPackage-").toFile();
     newDirectory.mkdirs();
     directory = newDirectory.getAbsolutePath();
     zipFile.extractAll(directory);

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/3b01d990/engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java b/engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java
index 7e23fa5..4c1227a 100644
--- a/engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java
+++ b/engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java
@@ -387,7 +387,8 @@ public class StramClientUtils
       fs = newFileSystemInstance(conf);
       // after getting the dfsRootDirectory config parameter, redo the entire process with
the global config
       // load global settings from DFS
-      targetGlobalFile = new File(String.format("/tmp/dt-site-global-%s.xml", UserGroupInformation.getLoginUser().getShortUserName()));
+      targetGlobalFile = new File(String.format("%s/dt-site-global-%s.xml", System.getProperty("java.io.tmpdir"),
+          UserGroupInformation.getLoginUser().getShortUserName()));
       org.apache.hadoop.fs.Path hdfsGlobalPath = new org.apache.hadoop.fs.Path(StramClientUtils.getDTDFSConfigDir(fs,
conf), StramClientUtils.DT_SITE_GLOBAL_XML_FILE);
       LOG.debug("Copying global dt-site.xml from {} to {}", hdfsGlobalPath, targetGlobalFile.getAbsolutePath());
       fs.copyToLocalFile(hdfsGlobalPath, new org.apache.hadoop.fs.Path(targetGlobalFile.toURI()));


Mime
View raw message