Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exiting Spark-shell from the scala script

I am using this command to run scala scripts.

spark-shell -i test.scala

At the end of the execution of the script I still see spark-shell running.

I have used ":q/:quit" in the test.scala script to try and exit but it's not working.

like image 382
Ujjwal SIddharth Avatar asked Mar 17 '16 07:03

Ujjwal SIddharth


2 Answers

In version 2.4.3 System.exit(0) is working.

like image 110
abhijitcaps Avatar answered Nov 20 '22 12:11

abhijitcaps


You need to add exit() at the end of your script to avoid stepping into scala REPL.

Helloworld.scala

print("Hello World");
print("Second Line");
print("Bye now");
System.exit(0)

Run above

spark-shell -i helloworld.scala
like image 8
charles gomes Avatar answered Nov 20 '22 11:11

charles gomes