Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-51048][CORE] Support stop java spark context with exit code #49746

Closed
wants to merge 5 commits into from
Closed
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 @@ -552,6 +552,21 @@ class JavaSparkContext(val sc: SparkContext) extends Closeable {
sc.stop()
}

/**
* Shut down the SparkContext with exit code that will passed to scheduler backend.
* In client mode, client side may call `SparkContext.stop()` to clean up but exit with
* code not equal to 0. This behavior cause resource scheduler such as `ApplicationMaster`
* exit with success status but client side exited with failed status. Spark can call
* this method to stop SparkContext and pass client side correct exit code to scheduler backend.
* Then scheduler backend should send the exit code to corresponding resource scheduler
* to keep consistent.
*
* @param exitCode Specified exit code that will passed to scheduler backend in client mode.
*/
def stop(exitCode: Int): Unit = {
sc.stop(exitCode)
}

override def close(): Unit = stop()

/**
Expand Down