Skip to content

Commit

Permalink
Handle case where SPARK_HOME is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
pwendell committed Apr 15, 2014
1 parent c2a2909 commit be42f35
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ private[spark] class SparkSubmitArguments(args: Array[String]) {
if (primaryResource == null) SparkSubmit.printErrorAndExit("Must specify a primary resource")
if (mainClass == null) SparkSubmit.printErrorAndExit("Must specify a main class with --class")
if (propertiesFile == null) {
val sparkHome = sys.env("SPARK_HOME") // defined via `spark-class`
val sep = File.separator
val defaultPath = s"${sparkHome}${sep}conf${sep}spark-defaults.properties"
val file = new File(defaultPath)
if (file.exists()) {
propertiesFile = file.getAbsolutePath
}
sys.env.get("SPARK_HOME").foreach { sparkHome =>
val sep = File.separator
val defaultPath = s"${sparkHome}${sep}conf${sep}spark-defaults.properties"
val file = new File(defaultPath)
if (file.exists()) {
propertiesFile = file.getAbsolutePath
}
}
}

override def toString = {
Expand Down

0 comments on commit be42f35

Please sign in to comment.