From 9bd81d2c8979c9759d29bc6920181bf6a090dcb3 Mon Sep 17 00:00:00 2001 From: Jim Crist Date: Mon, 29 Oct 2018 10:15:28 -0500 Subject: [PATCH] Use NM_HOST to determine hostname (#97) Some clusters have infiniband enabled, which may get picked up by `InetAddress` when determining the application-master hostname/IP. Infiniband is not currently supported by gRPC, so this would result in failures. Instead of trying to more robustly determine the IP for a supported network interface, we rely on the `NM_HOST` environment variable, which is always set and must resolve correctly on all nodes for hadoop to properly work. --- .../java/com/anaconda/skein/ApplicationMaster.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/java/src/main/java/com/anaconda/skein/ApplicationMaster.java b/java/src/main/java/com/anaconda/skein/ApplicationMaster.java index d2747321..54477902 100644 --- a/java/src/main/java/com/anaconda/skein/ApplicationMaster.java +++ b/java/src/main/java/com/anaconda/skein/ApplicationMaster.java @@ -46,8 +46,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.security.PrivilegedAction; import java.util.ArrayList; @@ -151,7 +149,7 @@ public void run() { } }); - LOG.info("gRPC server started, listening on {}", grpcServer.getPort()); + LOG.info("gRPC server started at {}:{}", hostname, grpcServer.getPort()); } private void stopServer() { @@ -208,7 +206,7 @@ public void run() { } }); - LOG.info("WebUI server started, listening on {}", ui.getURI().getPort()); + LOG.info("WebUI server started at {}:{}", hostname, ui.getURI().getPort()); } private void stopUI() { @@ -435,12 +433,6 @@ public void run() throws Exception { loadApplicationSpec(); - try { - hostname = InetAddress.getLocalHost().getHostAddress(); - } catch (UnknownHostException exc) { - fatal("Couldn't determine hostname for appmaster", exc); - } - // Create ugi and add original tokens to it String userName = System.getenv(Environment.USER.name()); LOG.info("Running as user {}", userName); @@ -476,6 +468,7 @@ public void run() throws Exception { MAX_EXECUTOR_THREADS, true); + hostname = System.getenv(Environment.NM_HOST.name()); startServer(); startUI();