Skip to content

Commit 636fd78

Browse files
author
Devaraj K
committed
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.
1 parent 5349851 commit 636fd78

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import org.apache.hadoop.fs.{FileSystem, Path}
2828
import org.apache.hadoop.yarn.api._
2929
import org.apache.hadoop.yarn.api.records._
3030
import org.apache.hadoop.yarn.conf.YarnConfiguration
31+
import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException
3132

3233
import org.apache.spark.rpc._
3334
import org.apache.spark.{Logging, SecurityManager, SparkConf, SparkContext, SparkEnv,
@@ -370,6 +371,12 @@ private[spark] class ApplicationMaster(
370371
failureCount = 0
371372
} catch {
372373
case i: InterruptedException =>
374+
case a: ApplicationAttemptNotFoundException => {
375+
val message = "ApplicationAttemptNotFoundException was thrown from Reporter thread.";
376+
logError(message, a)
377+
finish(FinalApplicationStatus.FAILED, ApplicationMaster.EXIT_REPORTER_FAILURE,
378+
message)
379+
}
373380
case e: Throwable => {
374381
failureCount += 1
375382
if (!NonFatal(e) || failureCount >= reporterMaxFailures) {

0 commit comments

Comments
 (0)