Skip to content

[SPARK-58536] Fix getDefaultFinalStatus to return SUCCEEDED in cluster mode - #57736

Open
Lobo2008 wants to merge 1 commit into
apache:masterfrom
Lobo2008:fix-am-default-status
Open

[SPARK-58536] Fix getDefaultFinalStatus to return SUCCEEDED in cluster mode#57736
Lobo2008 wants to merge 1 commit into
apache:masterfrom
Lobo2008:fix-am-default-status

Conversation

@Lobo2008

@Lobo2008 Lobo2008 commented Aug 4, 2026

Copy link
Copy Markdown

What changes were proposed in this pull request?

Fix getDefaultFinalStatus() to return FinalApplicationStatus.SUCCEEDED
for cluster mode, matching its documentation.

Why are the changes needed?

The current implementation returns FAILED for cluster mode, while the
docstring says it should return SUCCEEDED. The docstring correctly
describes the intent: when a user's application calls System.exit(0),
the shutdown hook fires before finish(SUCCEEDED) can be reached. The
default status should be SUCCEEDED in this case, as the application
completed normally.

This is safe because genuinely failed applications call finish(FAILED)
explicitly, which sets finished = true, causing the shutdown hook to
skip 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.

…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.
@Lobo2008 Lobo2008 changed the title [SPARK-58536] Fix getDefaultFinalStatus to return SUCCEEDED in cluste… [SPARK-58536] Fix getDefaultFinalStatus to return SUCCEEDED in cluster mode Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant