Made Spark shell class directory configurable.

This commit is contained in:
root 2010-06-18 23:24:18 +00:00
Родитель 323571a177
Коммит 6aacaa6870
2 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -25,7 +25,7 @@ object Executor {
// If the REPL is in use, create a ClassLoader that will be able to
// read new classes defined by the REPL as the user types code
classLoader = this.getClass.getClassLoader
val classDir = System.getProperty("spark.repl.classdir")
val classDir = System.getProperty("spark.repl.current.classdir")
if (classDir != null) {
println("Using REPL classdir: " + classDir)
classLoader = new repl.ExecutorClassLoader(classDir, classLoader)

Просмотреть файл

@ -93,7 +93,8 @@ class SparkInterpreter(val settings: Settings, out: PrintWriter) {
/** directory to save .class files to */
//val virtualDirectory = new VirtualDirectory("(memory)", None)
val virtualDirectory = {
val tmpDir = new File(System.getProperty("java.io.tmpdir"))
val rootDir = new File(System.getProperty("spark.repl.classdir",
System.getProperty("java.io.tmpdir")))
var attempts = 0
val maxAttempts = 10
var outputDir: File = null
@ -104,12 +105,12 @@ class SparkInterpreter(val settings: Settings, out: PrintWriter) {
"after " + maxAttempts + " attempts!")
}
try {
outputDir = new File(tmpDir, "spark-" + UUID.randomUUID.toString)
outputDir = new File(rootDir, "spark-" + UUID.randomUUID.toString)
if (outputDir.exists() || !outputDir.mkdirs())
outputDir = null
} catch { case e: IOException => ; }
}
System.setProperty("spark.repl.classdir",
System.setProperty("spark.repl.current.classdir",
"file://" + outputDir.getAbsolutePath + "/")
if (SPARK_DEBUG_REPL)
println("Output directory: " + outputDir)