Skip to content

Commit 430cd78

Browse files
kmaehashiMarcelo Vanzin
authored and
Marcelo Vanzin
committed
[SPARK-9180] fix spark-shell to accept --name option
This patch fixes [[SPARK-9180]](https://issues.apache.org/jira/browse/SPARK-9180). Users can now set the app name of spark-shell using `spark-shell --name "whatever"`. Author: Kenichi Maehashi <[email protected]> Closes apache#7512 from kmaehashi/fix-spark-shell-app-name and squashes the following commits: e24991a [Kenichi Maehashi] use setIfMissing instead of setAppName 18aa4ad [Kenichi Maehashi] fix spark-shell to accept --name option
1 parent 798dff7 commit 430cd78

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

bin/spark-shell

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ function main() {
4747
# (see https://github.com/sbt/sbt/issues/562).
4848
stty -icanon min 1 -echo > /dev/null 2>&1
4949
export SPARK_SUBMIT_OPTS="$SPARK_SUBMIT_OPTS -Djline.terminal=unix"
50-
"$FWDIR"/bin/spark-submit --class org.apache.spark.repl.Main "$@"
50+
"$FWDIR"/bin/spark-submit --class org.apache.spark.repl.Main --name "Spark shell" "$@"
5151
stty icanon echo > /dev/null 2>&1
5252
else
5353
export SPARK_SUBMIT_OPTS
54-
"$FWDIR"/bin/spark-submit --class org.apache.spark.repl.Main "$@"
54+
"$FWDIR"/bin/spark-submit --class org.apache.spark.repl.Main --name "Spark shell" "$@"
5555
fi
5656
}
5757

bin/spark-shell2.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ if "x%SPARK_SUBMIT_OPTS%"=="x" (
3232
set SPARK_SUBMIT_OPTS="%SPARK_SUBMIT_OPTS% -Dscala.usejavacp=true"
3333

3434
:run_shell
35-
%SPARK_HOME%\bin\spark-submit2.cmd --class org.apache.spark.repl.Main %*
35+
%SPARK_HOME%\bin\spark-submit2.cmd --class org.apache.spark.repl.Main --name "Spark shell" %*

repl/scala-2.10/src/main/scala/org/apache/spark/repl/SparkILoop.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1008,9 +1008,9 @@ class SparkILoop(
10081008
val jars = SparkILoop.getAddedJars
10091009
val conf = new SparkConf()
10101010
.setMaster(getMaster())
1011-
.setAppName("Spark shell")
10121011
.setJars(jars)
10131012
.set("spark.repl.class.uri", intp.classServerUri)
1013+
.setIfMissing("spark.app.name", "Spark shell")
10141014
if (execUri != null) {
10151015
conf.set("spark.executor.uri", execUri)
10161016
}

repl/scala-2.11/src/main/scala/org/apache/spark/repl/Main.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ object Main extends Logging {
6565
val jars = getAddedJars
6666
val conf = new SparkConf()
6767
.setMaster(getMaster)
68-
.setAppName("Spark shell")
6968
.setJars(jars)
7069
.set("spark.repl.class.uri", classServer.uri)
70+
.setIfMissing("spark.app.name", "Spark shell")
7171
logInfo("Spark class server started at " + classServer.uri)
7272
if (execUri != null) {
7373
conf.set("spark.executor.uri", execUri)

0 commit comments

Comments
 (0)