Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to initialize Spark-Shell with command script #109

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ class SparkILoop(in0: Option[BufferedReader], protected val out: JPrintWriter,

addThunk(printWelcome())
addThunk(initializeSpark())
addThunk(runShellRC())

// it is broken on startup; go ahead and exit
if (intp.reporter.hasErrors)
Expand Down Expand Up @@ -958,6 +959,17 @@ class SparkILoop(in0: Option[BufferedReader], protected val out: JPrintWriter,
sparkContext
}

def runShellRC() {
if (System.getenv("SPARK_SHELL_RC") != null) {
loadCommand(System.getenv("SPARK_SHELL_RC"))
} else {
val rc_file = File(System.getProperty("user.home"))/".spark_shell_rc"
if (rc_file.exists) {
loadCommand(rc_file.toString())
}
}
}

private def getMaster(): String = {
val master = this.master match {
case Some(m) => m
Expand Down