如何在提交后退出spark-submit

Pet*_*han 15 hadoop-yarn apache-spark

当使用spark-submit(YARN模式)提交spark spark程序时,它会保持轮询状态并永不退出

提交后退出spark-submit中是否有任何选项?

===为什么这会让我烦恼===

流程序将永远运行,我不需要状态更新

我可以按ctrl + c来停止它,如果我手动启动它但我有很多流上下文启动,我需要使用脚本启动它们

我可以把spark-submit程序放在后台,但是经过大量的后台java进程创建后,用户对应的,将无法运行任何其他java进程,因为JVM无法创建GC线程

Mat*_*zyk 73

我知道这是一个古老的问题,但现在可以通过设置--conf spark.yarn.submit.waitAppCompletion=false何时使用来实现此目的spark-submit.这样,客户端将在成功提交申请后退出.

在YARN群集模式下,控制客户端在应用程序完成之前是否等待退出.如果设置为true,则客户端进程将保持活动状态,报告应用程序的状态.否则,客户端进程将在提交后退出.

此外,您可能需要设置--deploy-modecluster

在集群模式下,Spark驱动程序在应用程序主进程内运行,该进程由群集上的YARN管理,客户端可以在启动应用程序后消失.

更多信息,访问https://spark.apache.org/docs/1.6.1/running-on-yarn.html

  • 您应该获得一枚奖章。 (2认同)

小智 1

Interesting. I never thought about this issue. Not sure there is a clean way to do this, but I simply kill the submit process on the machine and the yarn job continues to run until you stop it specifically. So you can create a script that execute the spark submit and then kills it. When you will actually wanna stop the job use yarn -kill. Dirty but works.