File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
yarn/src/main/scala/org/apache/spark/deploy/yarn Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,14 @@ Most of the configs are the same for Spark on YARN as for other deployment modes
196196 It should be no larger than the global number of max attempts in the YARN configuration.
197197 </td >
198198</tr >
199+ <tr >
200+ <td ><code >spark.yarn.waitForCompletion</code ></td >
201+ <td >true</td >
202+ <td >
203+ Whether to wait for application to complete in cluster mode. If set this to true, client process will enter a loop to track application's status.
204+ Otherwise, client process will exist as long as application is successfully submitted.
205+ </td >
206+ </tr >
199207</table >
200208
201209# Launching Spark on YARN
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ private[spark] class Client(
6767 private val distCacheMgr = new ClientDistributedCacheManager ()
6868 private val isClusterMode = args.isClusterMode
6969 private val fireAndForget = isClusterMode &&
70- sparkConf.getBoolean(" spark.yarn.cluster.quiet " , false )
70+ ! sparkConf.getBoolean(" spark.yarn.submit.waitAppCompletion " , true )
7171
7272
7373 def stop (): Unit = yarnClient.stop()
@@ -622,13 +622,12 @@ private[spark] class Client(
622622 def run (): Unit = {
623623 val appId = submitApplication()
624624 if (fireAndForget) {
625- logInfo(" ... waiting before polling ResourceManager for application state" )
626- Thread .sleep(5000 )
627625 logInfo(" ... polling ResourceManager for application state" )
628-
629626 val report = getApplicationReport(appId)
630627 val state = report.getYarnApplicationState
631-
628+ if (state == YarnApplicationState .FAILED || state == YarnApplicationState .KILLED ) {
629+ throw new SparkException (s " Application finished with status: $state" )
630+ }
632631 logInfo(s " Application report for $appId (state: $state) " )
633632 logInfo(formatReportDetails(report))
634633 } else {
You can’t perform that action at this time.
0 commit comments