diff options
author | Patrick Wendell <pwendell@gmail.com> | 2014-01-05 15:10:05 -0800 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-01-05 15:16:01 -0800 |
commit | 94fdcda89638498f127abf3bb5231064182b4945 (patch) | |
tree | a6d09714a83aff122c60c8462f5d9b94edbe2a9b | |
parent | aaaa6731845495743aff4cc9bd64a54b9aa36c27 (diff) | |
download | spark-94fdcda89638498f127abf3bb5231064182b4945.tar.gz spark-94fdcda89638498f127abf3bb5231064182b4945.tar.bz2 spark-94fdcda89638498f127abf3bb5231064182b4945.zip |
Provide logging when attempts to connect to the master fail.
Without these it's a bit less clear what's going on for the user.
One thing I realize when doing this is that akka itself actually retries
the initial association. So the retry we currently have is redundant with
akka's.
-rw-r--r-- | core/src/main/scala/org/apache/spark/deploy/client/Client.scala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/client/Client.scala b/core/src/main/scala/org/apache/spark/deploy/client/Client.scala index 9bbd635ab9..481026eaa2 100644 --- a/core/src/main/scala/org/apache/spark/deploy/client/Client.scala +++ b/core/src/main/scala/org/apache/spark/deploy/client/Client.scala @@ -24,7 +24,8 @@ import scala.concurrent.duration._ import akka.actor._ import akka.pattern.ask -import akka.remote.{DisassociatedEvent, RemotingLifecycleEvent} +import akka.remote.{AssociationErrorEvent, DisassociatedEvent, RemotingLifecycleEvent} + import org.apache.spark.{Logging, SparkConf, SparkException} import org.apache.spark.deploy.{ApplicationDescription, ExecutorState} import org.apache.spark.deploy.DeployMessages._ @@ -110,6 +111,12 @@ private[spark] class Client( } } + private def isPossibleMaster(remoteUrl: Address) = { + masterUrls.map(s => Master.toAkkaUrl(s)) + .map(u => AddressFromURIString(u).hostPort) + .contains(remoteUrl.hostPort) + } + override def receive = { case RegisteredApplication(appId_, masterUrl) => appId = appId_ @@ -145,6 +152,9 @@ private[spark] class Client( logWarning(s"Connection to $address failed; waiting for master to reconnect...") markDisconnected() + case AssociationErrorEvent(cause, _, address, _) if isPossibleMaster(address) => + logWarning(s"Could not connect to $address: $cause") + case StopClient => markDead() sender ! true |