Skip to content

[SPARK-58536] Fix stale docstring for getDefaultFinalStatus in cluster mode - #57736

Open
Lobo2008 wants to merge 2 commits into
apache:masterfrom
Lobo2008:fix-am-default-status
Open

[SPARK-58536] Fix stale docstring for getDefaultFinalStatus in cluster mode#57736
Lobo2008 wants to merge 2 commits 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 the stale docstring of getDefaultFinalStatus() to match the
current implementation. The method returns FAILED for cluster mode
since SPARK-38270, but the docstring was never updated.

Why are the changes needed?

SPARK-38270 deliberately changed the default to FAILED to ensure
that the shutdown hook does not incorrectly report SUCCEEDED when
the application exits with a non-zero exit code. However, the
docstring still says SUCCEEDED, which is misleading.

Does this PR introduce any user-facing change?

No. Doc-only change.

How was this patch tested?

Doc-only change.

…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
final def getDefaultFinalStatus(): FinalApplicationStatus = {
if (isClusterMode) {
FinalApplicationStatus.FAILED
FinalApplicationStatus.SUCCEEDED

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This inverts a FAIL-SAFE default, and the justification rests on a STALE docstring rather than the code's intent. The FAILED default was set deliberately in SPARK-38270; the docstring mentioning SUCCEEDED predates that change and was not updated. The real defect is the comment, not the code. This PR resolves the mismatch in the wrong direction.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uros-b Thanks for the review! You're right — SPARK-38270 intentionally changed this
to FAILED. I've updated the PR to fix the stale docstring instead of the code.

…r mode

SPARK-38270 changed getDefaultFinalStatus() to return FAILED for cluster
mode, but the docstring was not updated and still says SUCCEEDED.
Fix the docstring to match the code.
@Lobo2008 Lobo2008 changed the title [SPARK-58536] Fix getDefaultFinalStatus to return SUCCEEDED in cluster mode [SPARK-58536] Fix stale docstring for getDefaultFinalStatus in cluster mode Aug 5, 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.

2 participants