From f14b68a4c98bf01db84afa55505868d42d8e4eb5 Mon Sep 17 00:00:00 2001 From: yf_liu Date: Thu, 9 Oct 2014 15:32:01 +0800 Subject: [PATCH] Add spark.tmp.dir to set temp directory for spark --- core/src/main/scala/org/apache/spark/util/Utils.scala | 6 +++++- docs/configuration.md | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala b/core/src/main/scala/org/apache/spark/util/Utils.scala index 3d307b3c16d3e..8efcc60a03ae3 100644 --- a/core/src/main/scala/org/apache/spark/util/Utils.scala +++ b/core/src/main/scala/org/apache/spark/util/Utils.scala @@ -233,7 +233,11 @@ private[spark] object Utils extends Logging { } /** Create a temporary directory inside the given parent directory */ - def createTempDir(root: String = System.getProperty("java.io.tmpdir")): File = { + def createTempDir(): File = { + val root: String = SparkEnv.get.conf.contains("spark.tmp.dir") match { + case true => SparkEnv.get.conf.get("spark.tmp.dir") + case false => System.getProperty("java.io.tmpdir") + } var attempts = 0 val maxAttempts = 10 var dir: File = null diff --git a/docs/configuration.md b/docs/configuration.md index f311f0d2a6206..80e61abe7e902 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -272,6 +272,16 @@ Apart from these, the following properties are also available, and may be useful `spark.mesos.executor.memoryOverhead` or 7% of `spark.executor.memory`. + + spark.tmp.dir + system property of java.io.tmpdir + + Set the temp directory for Spark. The Directory is mainly used for distribute files or jars by + Http File Server; store broadcast block; fetch and store dependencies(jars or files) by executors. + We recommend setting this directory to data disk to reduce the risk that the size of the system disk + will grow large. + + #### Shuffle Behavior