From 61c1e08f0c66f57e385c718e2b555149a195ce7f Mon Sep 17 00:00:00 2001 From: Lobo2008 <842315999@qq.com> Date: Tue, 4 Aug 2026 11:19:55 +0800 Subject: [PATCH] [SPARK-58536] Fix getDefaultFinalStatus to return SUCCEEDED in cluster mode The docstring for getDefaultFinalStatus() says it should return SUCCEEDED in cluster mode 'to handle if the user calls System.exit from the application code', but the implementation returns FAILED. This causes applications that exit normally via System.exit(0) in cluster mode to report FAILED to YARN RM when the shutdown hook fires before finish(SUCCEEDED) is reached. Fix the implementation to match the documented behavior. --- .../scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala b/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala index 9c9f6f3bc313a..79b766eddf1b7 100644 --- a/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala +++ b/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala @@ -351,7 +351,7 @@ private[spark] class ApplicationMaster( */ final def getDefaultFinalStatus(): FinalApplicationStatus = { if (isClusterMode) { - FinalApplicationStatus.FAILED + FinalApplicationStatus.SUCCEEDED } else { FinalApplicationStatus.UNDEFINED }