如何以独立模式和客户端模式终止作业?

时间:2018-09-03 17:47:09

标签: apache-spark

我使用spark-submit来运行作业,该作业有一些例外,它被阻止,所以我尝试使用ctrl + c来停止该过程。

  1. 我想知道此作业是否仍在群集上运行吗?

  2. 如果这不是杀死工作的正确方法,那是正确的方法?

  

^ C18 / 09/03 19:03:01 INFO SparkContext:从关机钩子调用stop()   18/09/03 19:03:01 INFO SparkUI:在http://x.x.x.x:4040处停止了Spark Web UI   18/09/03 19:03:01信息DA调度程序:作业2失败:计数在xxx.scala:155上,耗时773.555554 s   18/09/03 19:03:01信息DA调度程序:ShuffleMapStage 2(在xxx.scala:155处计数)在773.008 s中失败   18/09/03 19:03:01错误LiveListenerBus:SparkListenerBus已经停止!删除事件SparkListenerStageCompleted(org.apache.spark.scheduler.StageInfo@7f6a32f)   18/09/03 19:03:01错误LiveListenerBus:SparkListenerBus已经停止!删除事件SparkListenerJobEnd(2,1535994181627,JobFailed(org.apache.spark.SparkException:作业2已取消,因为SparkContext已关闭))   18/09/03 19:03:01错误LiveListenerBus:SparkListenerBus已经停止!删除事件SparkListenerSQLExecutionEnd(0,1535994181630)   18/09/03 19:03:01 INFO StandaloneSchedulerBackend:关闭所有执行程序   线程“主要” org.apache.spark.SparkException中的异常:由于SparkContext已关闭,作业2被取消       在org.apache.spark.scheduler.DAGScheduler $$ anonfun $ cleanUpAfterSchedulerStop $ 1.apply(DAGScheduler.scala:818)       在org.apache.spark.scheduler.DAGScheduler $$ anonfun $ cleanUpAfterSchedulerStop $ 1.apply(DAGScheduler.scala:816)中       在scala.collection.mutable.HashSet.foreach(HashSet.scala:78)       在org.apache.spark.scheduler.DAGScheduler.cleanUpAfterSchedulerStop(DAGScheduler.scala:816)       在org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onStop(DAGScheduler.scala:1685)       在org.apache.spark.util.EventLoop.stop(EventLoop.scala:83)       在org.apache.spark.scheduler.DAGScheduler.stop(DAGScheduler.scala:1604)       在org.apache.spark.SparkContext $$ anonfun $ stop $ 8.apply $ mcV $ sp(SparkContext.scala:1781)       在org.apache.spark.util.Utils $ .tryLogNonFatalError(Utils.scala:1290)       在org.apache.spark.SparkContext.stop(SparkContext.scala:1780)       在org.apache.spark.SparkContext $$ anonfun $ 2.apply $ mcV $ sp(SparkContext.scala:559)       在org.apache.spark.util.SparkShutdownHook.run(ShutdownHookManager.scala:215)       在org.apache.spark.util.SparkShutdownHookManager $$ anonfun $ runAll $ 1 $$ anonfun $ apply $ mcV $ sp $ 1.apply $ mcV $ sp(ShutdownHookManager.scala:187)中       在org.apache.spark.util.SparkShutdownHookManager $$ anonfun $ runAll $ 1 $$ anonfun $ apply $ mcV $ sp $ 1.apply(ShutdownHookManager.scala:187)       在org.apache.spark.util.SparkShutdownHookManager $$ anonfun $ runAll $ 1 $$ anonfun $ apply $ mcV $ sp $ 1.apply(ShutdownHookManager.scala:187)       在org.apache.spark.util.Utils $ .logUncaughtExceptions(Utils.scala:1953)       在org.apache.spark.util.SparkShutdownHookManager $$ anonfun $ runAll $ 1.apply $ mcV $ sp(ShutdownHookManager.scala:187)       在org.apache.spark.util.SparkShutdownHookManager $$ anonfun $ runAll $ 1.apply(ShutdownHookManager.scala:187)       在org.apache.spark.util.SparkShutdownHookManager $$ anonfun $ runAll $ 1.apply(ShutdownHookManager.scala:187)       在scala.util.Try $ .apply(Try.scala:192)       在org.apache.spark.util.SparkShutdownHookManager.runAll(ShutdownHookManager.scala:187)       在org.apache.spark.util.SparkShutdownHookManager $$ anon $ 2.run(ShutdownHookManager.scala:177)       在org.apache.hadoop.util.ShutdownHookManager $ 1.run(ShutdownHookManager.java:54)       在org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:632)       在org.apache.spark.SparkContext.runJob(SparkContext.scala:1873)       在org.apache.spark.SparkContext.runJob(SparkContext.scala:1886)       在org.apache.spark.SparkContext.runJob(SparkContext.scala:1899)       在org.apache.spark.SparkContext.runJob(SparkContext.scala:1913)       在org.apache.spark.rdd.RDD $$ anonfun $ collect $ 1.apply(RDD.scala:912)       在org.apache.spark.rdd.RDDOperationScope $ .withScope(RDDOperationScope.scala:151)       在org.apache.spark.rdd.RDDOperationScope $ .withScope(RDDOperationScope.scala:112)       在org.apache.spark.rdd.RDD.withScope(RDD.scala:358)       在org.apache.spark.rdd.RDD.collect(RDD.scala:911)       在org.apache.spark.sql.execution.SparkPlan.executeCollect(SparkPlan.scala:290)       位于org.apache.spark.sql.Dataset $$ anonfun $ org $ apache $ spark $ sql $ Dataset $$ execute $ 1 $ 1.apply(Dataset.scala:2193)       在org.apache.spark.sql.execution.SQLExecution $ .withNewExecutionId(SQLExecution.scala:57)       在org.apache.spark.sql.Dataset.withNewExecutionId(Dataset.scala:2546)       在org.apache.spark.sql.Dataset.org $ apache $ spark $ sql $ Dataset $$ execute $ 1(Dataset.scala:2192)       在org.apache.spark.sql.Dataset.org $ apache $ spark $ sql $ Dataset $$ collect(Dataset.scala:2199)       在org.apache.spark.sql.Dataset $$ anonfun $ count $ 1.apply(Dataset.scala:2227)       在org.apache.spark.sql.Dataset $$ anonfun $ count $ 1.apply(Dataset.scala:2226)       在org.apache.spark.sql.Dataset.withCallback(Dataset.scala:2559)       在org.apache.spark.sql.Dataset.count(Dataset.scala:2226)       在xx.xx.xx.weekLyLoadingIDFA(xx.scala:155)       在xx.xx.xx.retrieve(xx.scala:171)       在xx.xx.xx.run(xx.scala:65)       位于xx.xx.xxRunner $ .delayedEndpoint $ io $ xxx $ CellRunner $ 1(xx.scala:12)       在xx.xx.xxRunner $ delayedInit $ body.apply(xx.scala:11)       在scala.Function0 $ class.apply $ mcV $ sp(Function0.scala:34)       在scala.runtime.AbstractFunction0.apply $ mcV $ sp(AbstractFunction0.scala:12)       在scala.App $$ anonfun $ main $ 1.apply(App.scala:76)       在scala.App $$ anonfun $ main $ 1.apply(App.scala:76)       在scala.collection.immutable.List.foreach(List.scala:381)       在scala.collection.generic.TraversableForwarder $ class.foreach(TraversableForwarder.scala:35)       在scala.App $ class.main(App.scala:76)       位于xx.xx.xxRunner $ .main(xx.scala:11)       位于xx.xx.xxRunner.main(xx.scala)       在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处       在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)       在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)       在java.lang.reflect.Method.invoke(Method.java:498)       在org.apache.spark.deploy.SparkSubmit $ .org $ apache $ spark $ deploy $ SparkSubmit $$ runMain(SparkSubmit.scala:736)       在org.apache.spark.deploy.SparkSubmit $ .doRunMain $ 1(SparkSubmit.scala:185)       在org.apache.spark.deploy.SparkSubmit $ .submit(SparkSubmit.scala:210)       在org.apache.spark.deploy.SparkSubmit $ .main(SparkSubmit.scala:124)       在org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)   18/09/03 19:03:01 INFO CoarseGrainedSchedulerBackend $ DriverEndpoint:要求每个执行者关闭   18/09/03 19:03:01 INFO MapOutputTrackerMasterEndpoint:MapOutputTrackerMasterEndpoint已停止!   18/09/03 19:03:01信息MemoryStore:MemoryStore已清除   18/09/03 19:03:01信息BlockManager:BlockManager已停止   18/09/03 19:03:01信息BlockManagerMaster:BlockManagerMaster已停止   18/09/03 19:03:01 INFO OutputCommitCoordinator $ OutputCommitCoordinatorEndpoint:OutputCommitCoordinator已停止!   18/09/03 19:03:01错误TransportResponseHandler:关闭与xxxxx / xxxx:7077的连接时,仍有1个请求未完成   18/09/03 19:03:01信息SparkContext:成功停止了SparkContext   18/09/03 19:03:01 INFO ShutdownHookManager:调用了关闭挂钩   18/09/03 19:03:01信息ShutdownHookManager:删除目录/ tmp / spark / spark-xxxxxxxxxx

4 个答案:

答案 0 :(得分:1)

以上日志显示SparkContext已关闭。这意味着Spark作业不再在集群上运行。

由于您是在“客户端”模式下运行应用程序,因此ctrl + c通常会终止该应用程序。

答案 1 :(得分:1)

这取决于资源管理器。在我的情况下,ctrl + c在纱线上工作正常,该工作被终止,您仍然呆在火花壳中。您也可以从Spark WEB UI或YARN中取消工作。

答案 2 :(得分:1)

如果您在纱线上运行,则可以通过以下命令杀死spark应用程序

yarn application -kill applicationId

对于独立模式下的火花使用

spark-submit — kill applicationId — master masterurl

答案 3 :(得分:0)

启动Spark StandAlone群集时,它的主机在8080端口上具有UI。 在主用户界面上,您将在“运行应用程序”选项卡中看到您的应用程序。 对应于每个应用程序,都有一个(杀死)选项按钮。 只需按下该按钮,它将要求您进行确认。确认关闭。 In the Image, you can see a running application & there is a kill option associated with it.

快乐的火花。...