aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Vanzin <vanzin@cloudera.com>2015-10-07 11:38:47 -0700
committerMarcelo Vanzin <vanzin@cloudera.com>2015-10-07 11:38:47 -0700
commit6ca27f855075d65eb4535f1f2ed4fc9e68744231 (patch)
treef5005e109296833d179ecf40255452b9388c602f
parent4b74755122d51edb1257d4f3785fb24508681068 (diff)
downloadspark-6ca27f855075d65eb4535f1f2ed4fc9e68744231.tar.gz
spark-6ca27f855075d65eb4535f1f2ed4fc9e68744231.tar.bz2
spark-6ca27f855075d65eb4535f1f2ed4fc9e68744231.zip
[SPARK-10964] [YARN] Correctly register the AM with the driver.
The `self` method returns null when called from the constructor; instead, registration should happen in the `onStart` method, at which point the `self` reference has already been initialized. Author: Marcelo Vanzin <vanzin@cloudera.com> Closes #9005 from vanzin/SPARK-10964.
-rw-r--r--core/src/main/scala/org/apache/spark/scheduler/cluster/YarnSchedulerBackend.scala2
-rw-r--r--yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala4
2 files changed, 4 insertions, 2 deletions
diff --git a/core/src/main/scala/org/apache/spark/scheduler/cluster/YarnSchedulerBackend.scala b/core/src/main/scala/org/apache/spark/scheduler/cluster/YarnSchedulerBackend.scala
index 6a4b536dee..e0107f9d3d 100644
--- a/core/src/main/scala/org/apache/spark/scheduler/cluster/YarnSchedulerBackend.scala
+++ b/core/src/main/scala/org/apache/spark/scheduler/cluster/YarnSchedulerBackend.scala
@@ -169,7 +169,7 @@ private[spark] abstract class YarnSchedulerBackend(
override def receive: PartialFunction[Any, Unit] = {
case RegisterClusterManager(am) =>
logInfo(s"ApplicationMaster registered as $am")
- amEndpoint = Some(am)
+ amEndpoint = Option(am)
case AddWebUIFilter(filterName, filterParams, proxyBase) =>
addWebUIFilter(filterName, filterParams, proxyBase)
diff --git a/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala b/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala
index 0df31736c1..a2ccdc05d7 100644
--- a/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala
+++ b/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala
@@ -556,7 +556,9 @@ private[spark] class ApplicationMaster(
override val rpcEnv: RpcEnv, driver: RpcEndpointRef, isClusterMode: Boolean)
extends RpcEndpoint with Logging {
- driver.send(RegisterClusterManager(self))
+ override def onStart(): Unit = {
+ driver.send(RegisterClusterManager(self))
+ }
override def receive: PartialFunction[Any, Unit] = {
case x: AddWebUIFilter =>