aboutsummaryrefslogtreecommitdiff
path: root/yarn/alpha
diff options
context:
space:
mode:
authorzsxwing <zsxwing@gmail.com>2014-10-22 15:08:28 -0700
committerAndrew Or <andrewor14@gmail.com>2014-10-22 15:08:28 -0700
commiteb62094e820992355e4cf8ba0e881417f8c6bbfa (patch)
tree0b0f1fcbc7aea1472d68dd4deedc08c61ebba4fc /yarn/alpha
parent457ef5955114a19a8ec45572a0a0086ec675ddf1 (diff)
downloadspark-eb62094e820992355e4cf8ba0e881417f8c6bbfa.tar.gz
spark-eb62094e820992355e4cf8ba0e881417f8c6bbfa.tar.bz2
spark-eb62094e820992355e4cf8ba0e881417f8c6bbfa.zip
[SPARK-3877][YARN] Throw an exception when application is not successful so that the exit code wil be set to 1 (for branch-1.1)
This is a patch to fix SPARK-3877 in branch-1.1. See also #2732 Author: zsxwing <zsxwing@gmail.com> Closes #2748 from zsxwing/SPARK-3877-branch-1.1 and squashes the following commits: 3701984 [zsxwing] Remove System.exit from Client.scala 8681881 [zsxwing] [SPARK-3877] Throw an exception when application is not successful so that the exit code wil be set to 1
Diffstat (limited to 'yarn/alpha')
-rw-r--r--yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/Client.scala27
1 files changed, 11 insertions, 16 deletions
diff --git a/yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/Client.scala b/yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/Client.scala
index 3607eed1f1..c51ce62c11 100644
--- a/yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/Client.scala
+++ b/yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/Client.scala
@@ -31,7 +31,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration
import org.apache.hadoop.yarn.ipc.YarnRPC
import org.apache.hadoop.yarn.util.{Apps, Records}
-import org.apache.spark.{Logging, SparkConf}
+import org.apache.spark.{Logging, SparkConf, SparkException}
/**
* Version of [[org.apache.spark.deploy.yarn.ClientBase]] tailored to YARN's alpha API.
@@ -84,7 +84,9 @@ class Client(clientArgs: ClientArguments, hadoopConf: Configuration, spConf: Spa
def run() {
val appId = runApp()
- monitorApplication(appId)
+ if (!monitorApplication(appId)) {
+ throw new SparkException("Application is not successful")
+ }
}
def logClusterResourceDetails() {
@@ -138,10 +140,12 @@ class Client(clientArgs: ClientArguments, hadoopConf: Configuration, spConf: Spa
)
val state = report.getYarnApplicationState()
- if (state == YarnApplicationState.FINISHED ||
- state == YarnApplicationState.FAILED ||
+ if (state == YarnApplicationState.FINISHED) {
+ return report.getFinalApplicationStatus() == FinalApplicationStatus.SUCCEEDED
+ }
+ if (state == YarnApplicationState.FAILED ||
state == YarnApplicationState.KILLED) {
- return true
+ return false
}
}
true
@@ -162,16 +166,7 @@ object Client {
val sparkConf = new SparkConf
- try {
- val args = new ClientArguments(argStrings, sparkConf)
- new Client(args, sparkConf).run()
- } catch {
- case e: Exception => {
- Console.err.println(e.getMessage)
- System.exit(1)
- }
- }
-
- System.exit(0)
+ val args = new ClientArguments(argStrings, sparkConf)
+ new Client(args, sparkConf).run()
}
}