[SPARK-58536] Fix getDefaultFinalStatus to return SUCCEEDED in cluster mode - #57736
Open
Lobo2008 wants to merge 1 commit into
Open
[SPARK-58536] Fix getDefaultFinalStatus to return SUCCEEDED in cluster mode#57736Lobo2008 wants to merge 1 commit into
Lobo2008 wants to merge 1 commit into
Conversation
…r 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Fix
getDefaultFinalStatus()to returnFinalApplicationStatus.SUCCEEDEDfor cluster mode, matching its documentation.
Why are the changes needed?
The current implementation returns
FAILEDfor cluster mode, while thedocstring says it should return
SUCCEEDED. The docstring correctlydescribes the intent: when a user's application calls
System.exit(0),the shutdown hook fires before
finish(SUCCEEDED)can be reached. Thedefault status should be
SUCCEEDEDin this case, as the applicationcompleted normally.
This is safe because genuinely failed applications call
finish(FAILED)explicitly, which sets
finished = true, causing the shutdown hook toskip the default status entirely.
Does this PR introduce any user-facing change?
Yes — cluster mode applications that exit via
System.exit(0)will now report SUCCEEDED to YARN RM instead of FAILED.How was this patch tested?
Manual testing with Spark 4.1.1 in cluster mode on Hadoop 3.2 RM
with Hadoop 3.4.2 client. Verified that YARN RM shows SUCCEEDED
after the fix.