Skip to content
Snippets Groups Projects
Commit d89c7141 authored by jerryshao's avatar jerryshao Committed by Marcelo Vanzin
Browse files

[SPARK-13642][YARN] Changed the default application exit state to failed for yarn cluster mode

## What changes were proposed in this pull request?

Changing the default exit state to `failed` for any application running on yarn cluster mode.

## How was this patch tested?

Unit test is done locally.

CC tgravescs and vanzin .

Author: jerryshao <sshao@hortonworks.com>

Closes #11693 from jerryshao/SPARK-13642.
parent 5e6f2f45
No related branches found
No related tags found
No related merge requests found
...@@ -152,13 +152,13 @@ private[spark] class ApplicationMaster( ...@@ -152,13 +152,13 @@ private[spark] class ApplicationMaster(
val isLastAttempt = client.getAttemptId().getAttemptId() >= maxAppAttempts val isLastAttempt = client.getAttemptId().getAttemptId() >= maxAppAttempts
if (!finished) { if (!finished) {
// This happens when the user application calls System.exit(). We have the choice // The default state of ApplicationMaster is failed if it is invoked by shut down hook.
// of either failing or succeeding at this point. We report success to avoid // This behavior is different compared to 1.x version.
// retrying applications that have succeeded (System.exit(0)), which means that // If user application is exited ahead of time by calling System.exit(N), here mark
// applications that explicitly exit with a non-zero status will also show up as // this application as failed with EXIT_EARLY. For a good shutdown, user shouldn't call
// succeeded in the RM UI. // System.exit(0) to terminate the application.
finish(finalStatus, finish(finalStatus,
ApplicationMaster.EXIT_SUCCESS, ApplicationMaster.EXIT_EARLY,
"Shutdown hook called before final status was reported.") "Shutdown hook called before final status was reported.")
} }
...@@ -209,7 +209,7 @@ private[spark] class ApplicationMaster( ...@@ -209,7 +209,7 @@ private[spark] class ApplicationMaster(
*/ */
final def getDefaultFinalStatus(): FinalApplicationStatus = { final def getDefaultFinalStatus(): FinalApplicationStatus = {
if (isClusterMode) { if (isClusterMode) {
FinalApplicationStatus.SUCCEEDED FinalApplicationStatus.FAILED
} else { } else {
FinalApplicationStatus.UNDEFINED FinalApplicationStatus.UNDEFINED
} }
...@@ -653,6 +653,7 @@ object ApplicationMaster extends Logging { ...@@ -653,6 +653,7 @@ object ApplicationMaster extends Logging {
private val EXIT_SC_NOT_INITED = 13 private val EXIT_SC_NOT_INITED = 13
private val EXIT_SECURITY = 14 private val EXIT_SECURITY = 14
private val EXIT_EXCEPTION_USER_CLASS = 15 private val EXIT_EXCEPTION_USER_CLASS = 15
private val EXIT_EARLY = 16
private var master: ApplicationMaster = _ private var master: ApplicationMaster = _
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment