Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/5343#discussion_r27724310
--- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
@@ -105,6 +102,16 @@ private[spark] class Client(
// Finally, submit and monitor the application
logInfo(s"Submitting application ${appId.getId} to ResourceManager")
yarnClient.submitApplication(appContext)
+
+ // In YARN Cluster mode, AM is not killed when the client is
terminated by default.
+ // But if spark.yarn.force.shutdown.am is set true, AM is force
shutdown.
+ if (isClusterMode &&
sparkConf.getBoolean("spark.yarn.am.force.shutdown", false)) {
+ val shutdownHook = new Runnable {
+ override def run() { yarnClient.killApplication(appId) }
+ }
+ ShutdownHookManager.get().addShutdownHook(shutdownHook, 0)
--- End diff --
It seems hacky to put all this cleanup logic into shutdown hooks; can't
this be in `stop()`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]