从Scala脚本退出Spark-shell [英] Exiting Spark-shell from the scala script

查看:380
本文介绍了从Scala脚本退出Spark-shell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此命令来运行Scala脚本.

I am using this command to run scala scripts.

spark-shell -i test.scala

在脚本执行结束时,我仍然看到spark-shell正在运行.

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

我在test.scala脚本中使用了:q/:quit"来尝试退出,但是它不起作用.

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

推荐答案

您需要在脚本的末尾添加exit(),以避免进入scala REPL.

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

Helloworld.scala

Helloworld.scala

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

在上方跑

spark-shell -i helloworld.scala

这篇关于从Scala脚本退出Spark-shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆