Skip to content

Commit ca0690b

Browse files
Devaraj KAndrew Or
authored andcommitted
[SPARK-4117][YARN] Spark on Yarn handle AM being told command from RM
Spark on Yarn handle AM being told command from RM When RM throws ApplicationAttemptNotFoundException for allocate invocation, making the ApplicationMaster to finish immediately without any retries. Author: Devaraj K <[email protected]> Closes #10129 from devaraj-kavali/SPARK-4117.
1 parent a89e8b6 commit ca0690b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,14 @@ private[spark] class ApplicationMaster(
376376
case i: InterruptedException =>
377377
case e: Throwable => {
378378
failureCount += 1
379-
if (!NonFatal(e) || failureCount >= reporterMaxFailures) {
379+
// this exception was introduced in hadoop 2.4 and this code would not compile
380+
// with earlier versions if we refer it directly.
381+
if ("org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException" ==
382+
e.getClass().getName()) {
383+
logError("Exception from Reporter thread.", e)
384+
finish(FinalApplicationStatus.FAILED, ApplicationMaster.EXIT_REPORTER_FAILURE,
385+
e.getMessage)
386+
} else if (!NonFatal(e) || failureCount >= reporterMaxFailures) {
380387
finish(FinalApplicationStatus.FAILED,
381388
ApplicationMaster.EXIT_REPORTER_FAILURE, "Exception was thrown " +
382389
s"$failureCount time(s) from Reporter thread.")

0 commit comments

Comments
 (0)