livy-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-livy] yiheng commented on a change in pull request #189: [LIVY-616] Livy Server discovery
Date Mon, 02 Sep 2019 08:34:52 GMT
yiheng commented on a change in pull request #189: [LIVY-616] Livy Server discovery
URL: https://github.com/apache/incubator-livy/pull/189#discussion_r319856962
 
 

 ##########
 File path: server/src/main/scala/org/apache/livy/server/LivyServer.scala
 ##########
 @@ -385,6 +389,25 @@ class LivyServer extends Logging {
     }
   }
 
+  private[livy] def setServerUri(livyConf: LivyConf,
+                                 mockCuratorClient: Option[CuratorFramework] = None): Unit
= {
+    if (Option(livyConf.get(LIVY_ZOOKEEPER_URL)).isDefined) {
+      val discoveryManager = LivyDiscoveryManager(livyConf, mockCuratorClient)
+      val host = resolvedSeverHost(livyConf)
+      val uri = new URI(s"http://$host:${livyConf.getInt(LivyConf.SERVER_PORT)}")
+      discoveryManager.setServerUri(uri)
+    }
+  }
+
+  private def resolvedSeverHost(livyConf: LivyConf) = {
+    val host = livyConf.get(LivyConf.SERVER_HOST)
+    if (host.equals(livyConf.get(LivyConf.SERVER_HOST.dflt.toString))) {
+      InetAddress.getLocalHost.getHostName
 
 Review comment:
   I do not quite understand the if condition here. Could you please explain it a bit? Thanks.
   
   And another question is why we return the hostname instead of IP here? IMHO, IP should
be more convenient, as hostname user needs to update their hosts file or set up the name service.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message