Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,13 @@ private[spark] class ApplicationMaster(

/**
* Set the default final application status for client mode to UNDEFINED to handle
* if YARN HA restarts the application so that it properly retries. Set the final
* status to SUCCEEDED in cluster mode to handle if the user calls System.exit
* from the application code.
* if YARN HA restarts the application so that it properly retries. SPARK-38270
* changed the default for cluster mode to FAILED to prevent the shutdown hook from
* reporting SUCCEEDED when the application exits with a non-zero exit code.
*/
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.

} else {
FinalApplicationStatus.UNDEFINED
}
Expand Down