diff options
author | Jey Kottalam <jey@cs.berkeley.edu> | 2013-07-24 14:16:50 -0700 |
---|---|---|
committer | Jey Kottalam <jey@cs.berkeley.edu> | 2013-08-15 16:50:37 -0700 |
commit | 8bb0bd11cea8a16d21c56c1b80b31a1c5605a414 (patch) | |
tree | 5c974c81439f4a4d655f51119de443fbe8b8cd05 /yarn/src/main/scala | |
parent | e2d7656ca3d561f0a6fc8dd81ef46e4aa6ba608e (diff) | |
download | spark-8bb0bd11cea8a16d21c56c1b80b31a1c5605a414.tar.gz spark-8bb0bd11cea8a16d21c56c1b80b31a1c5605a414.tar.bz2 spark-8bb0bd11cea8a16d21c56c1b80b31a1c5605a414.zip |
YARN ApplicationMaster shouldn't wait forever
Diffstat (limited to 'yarn/src/main/scala')
-rw-r--r-- | yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala b/yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala index d69a969d42..15dbd1c0fb 100644 --- a/yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala +++ b/yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala @@ -124,7 +124,8 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration) e private def waitForSparkMaster() { logInfo("Waiting for spark driver to be reachable.") var driverUp = false - while(!driverUp) { + var tries = 0 + while(!driverUp && tries < 10) { val driverHost = System.getProperty("spark.driver.host") val driverPort = System.getProperty("spark.driver.port") try { @@ -136,6 +137,7 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration) e case e: Exception => logWarning("Failed to connect to driver at " + driverHost + ":" + driverPort + ", retrying") Thread.sleep(100) + tries = tries + 1 } } } @@ -176,7 +178,7 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration) e var sparkContext: SparkContext = null ApplicationMaster.sparkContextRef.synchronized { var count = 0 - while (ApplicationMaster.sparkContextRef.get() == null) { + while (ApplicationMaster.sparkContextRef.get() == null && count < 10) { logInfo("Waiting for spark context initialization ... " + count) count = count + 1 ApplicationMaster.sparkContextRef.wait(10000L) |