Skip to content

Commit

Permalink
[BUILD] Add the ability to launch spark-shell from SBT.
Browse files Browse the repository at this point in the history
Now you can quickly launch the spark-shell without building an assembly.  For quick development iteration run `build/sbt ~sparkShell` and calling exit will relaunch with any changes.

Author: Michael Armbrust <[email protected]>

Closes apache#4438 from marmbrus/sparkShellSbt and squashes the following commits:

b4e44fe [Michael Armbrust] [BUILD] Add the ability to launch spark-shell from SBT.
  • Loading branch information
marmbrus authored and rxin committed Feb 7, 2015
1 parent 1390e56 commit e9a4fe1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions project/SparkBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,29 @@ object SparkBuild extends PomBuild {

enable(Flume.settings)(streamingFlumeSink)


/**
* Adds the ability to run the spark shell directly from SBT without building an assembly
* jar.
*
* Usage: `build/sbt sparkShell`
*/
val sparkShell = taskKey[Unit]("start a spark-shell.")

enable(Seq(
connectInput in run := true,
fork := true,
outputStrategy in run := Some (StdoutOutput),

javaOptions ++= Seq("-Xmx2G", "-XX:MaxPermSize=1g"),

sparkShell := {
(runMain in Compile).toTask(" org.apache.spark.repl.Main -usejavacp").value
}
))(assembly)

enable(Seq(sparkShell := sparkShell in "assembly"))(spark)

// TODO: move this to its upstream project.
override def projectDefinitions(baseDirectory: File): Seq[Project] = {
super.projectDefinitions(baseDirectory).map { x =>
Expand Down

0 comments on commit e9a4fe1

Please sign in to comment.