Skip to content

Commit

Permalink
LIVY-311. Set classpath in MiniCluster only when it is not in real cl…
Browse files Browse the repository at this point in the history
…uster (apache#286)
  • Loading branch information
zjffdu authored and alex-the-man committed Feb 8, 2017
1 parent 69462b9 commit 34f6c7f
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,16 @@ class MiniCluster(config: Map[String, String]) extends Cluster with MiniClusterU
assert(tempDir.mkdir(), "Cannot create temp test dir.")
sparkConfDir = mkdir("spark-conf")

val sparkScalaVersion = getSparkScalaVersion()
val classPathFile =
new File(s"minicluster-dependencies/scala-$sparkScalaVersion/target/classpath")
assert(classPathFile.isFile,
s"Cannot read MiniCluster classpath file: ${classPathFile.getCanonicalPath}")
val sparkClassPath =
FileUtils.readFileToString(classPathFile, Charset.defaultCharset())

// When running a real Spark cluster, don't set the classpath.
val extraCp = if (!isRealSpark()) {
val sparkScalaVersion = getSparkScalaVersion()
val classPathFile =
new File(s"minicluster-dependencies/scala-$sparkScalaVersion/target/classpath")
assert(classPathFile.isFile,
s"Cannot read MiniCluster classpath file: ${classPathFile.getCanonicalPath}")
val sparkClassPath =
FileUtils.readFileToString(classPathFile, Charset.defaultCharset())

val dummyJar = Files.createTempFile(Paths.get(tempDir.toURI), "dummy", "jar").toFile
Map(
SparkLauncher.DRIVER_EXTRA_CLASSPATH -> sparkClassPath,
Expand Down

0 comments on commit 34f6c7f

Please sign in to comment.