зеркало из https://github.com/microsoft/spark.git
Made Spark shell class directory configurable.
This commit is contained in:
Родитель
323571a177
Коммит
6aacaa6870
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче