Skip to content

Commit

Permalink
Use NM_HOST to determine hostname (#97)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jcrist committed Oct 29, 2018
1 parent 4908e84 commit 9bd81d2
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions java/src/main/java/com/anaconda/skein/ApplicationMaster.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -476,6 +468,7 @@ public void run() throws Exception {
MAX_EXECUTOR_THREADS,
true);

hostname = System.getenv(Environment.NM_HOST.name());
startServer();
startUI();

Expand Down

0 comments on commit 9bd81d2

Please sign in to comment.