Skip to content

Commit 41f8c8a

Browse files
author
Marcelo Vanzin
committed
Fix app status reporting.
1 parent c0794be commit 41f8c8a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ private[spark] class ApplicationMaster(args: ApplicationMasterArguments,
128128
logInfo(s"Finishing ApplicationMaster with $status" +
129129
Option(diagnostics).map(msg => s" (diag message: $msg)").getOrElse(""))
130130
finished = true
131+
finalStatus = status
131132
reporterThread.interrupt()
132133
try {
133134
if (Thread.currentThread() != reporterThread) {
@@ -341,17 +342,19 @@ private[spark] class ApplicationMaster(args: ApplicationMasterArguments,
341342

342343
val t = new Thread {
343344
override def run() {
345+
var status = FinalApplicationStatus.FAILED
344346
try {
345347
// Copy
346348
val mainArgs = new Array[String](args.userArgs.size)
347349
args.userArgs.copyToArray(mainArgs, 0, args.userArgs.size)
348350
mainMethod.invoke(null, mainArgs)
349351
// Some apps have "System.exit(0)" at the end. The user thread will stop here unless
350352
// it has an uncaught exception thrown out. It needs a shutdown hook to set SUCCEEDED.
351-
finalStatus = FinalApplicationStatus.SUCCEEDED
353+
status = FinalApplicationStatus.SUCCEEDED
352354
} finally {
353355
logDebug("Finishing main")
354356
}
357+
finalStatus = status
355358
}
356359
}
357360
t.setName("Driver")

0 commit comments

Comments
 (0)