You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by mo...@apache.org on 2017/05/05 01:13:26 UTC

reef git commit: [REEF-1777] Pass IP address instead of empty string or host name when registering Application Master

Repository: reef
Updated Branches:
  refs/heads/master 2ce19a571 -> 4551b471e


[REEF-1777] Pass IP address instead of empty string or host name when registering Application Master

This is required for Azure Data Lake containers and should be backward compatible for other YARN environments

JIRA: [REEF-1777](https://issues.apache.org/jira/browse/REEF-1777)

This closes #1291


Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/4551b471
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/4551b471
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/4551b471

Branch: refs/heads/master
Commit: 4551b471eae9307769ca2babe0c41255a7edb47f
Parents: 2ce19a5
Author: Julia Wang <ju...@apache.org>
Authored: Tue May 2 17:37:15 2017 -0700
Committer: Sergiy Matusevych <mo...@apache.org>
Committed: Thu May 4 13:48:59 2017 -0700

----------------------------------------------------------------------
 .../reef/runtime/yarn/driver/YarnContainerManager.java  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/4551b471/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java b/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java
index 58df83a..1b99613 100644
--- a/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java
+++ b/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java
@@ -48,6 +48,7 @@ import org.apache.reef.runtime.yarn.driver.parameters.YarnHeartbeatPeriod;
 import org.apache.reef.tang.InjectionFuture;
 import org.apache.reef.tang.annotations.Parameter;
 import org.apache.reef.util.Optional;
+import org.apache.reef.wake.remote.address.LocalAddressProvider;
 import org.apache.reef.wake.remote.impl.ObjectSerializableCodec;
 
 import javax.inject.Inject;
@@ -68,9 +69,6 @@ final class YarnContainerManager implements AMRMClientAsync.CallbackHandler, NMC
 
   private static final String RUNTIME_NAME = "YARN";
 
-  /** Default hostname to provide in the Application Master registration. */
-  private static final String AM_REGISTRATION_HOST = "";
-
   /** Default port number to provide in the Application Master registration. */
   private static final int AM_REGISTRATION_PORT = -1;
 
@@ -88,6 +86,7 @@ final class YarnContainerManager implements AMRMClientAsync.CallbackHandler, NMC
   private final ContainerRequestCounter containerRequestCounter;
   private final DriverStatusManager driverStatusManager;
   private final String trackingUrl;
+  private final String amRegistrationHost;
 
   private final String jobSubmissionDirectory;
   private final REEFFileNames reefFileNames;
@@ -107,6 +106,7 @@ final class YarnContainerManager implements AMRMClientAsync.CallbackHandler, NMC
       final DriverStatusManager driverStatusManager,
       final REEFFileNames reefFileNames,
       final TrackingURLProvider trackingURLProvider,
+      final LocalAddressProvider addressProvider,
       final RackNameFormatter rackNameFormatter,
       final InjectionFuture<ProgressProvider> progressProvider) throws IOException {
 
@@ -119,7 +119,9 @@ final class YarnContainerManager implements AMRMClientAsync.CallbackHandler, NMC
     this.yarnConf = yarnConf;
     this.yarnProxyUser = yarnProxyUser;
     this.rackNameFormatter = rackNameFormatter;
+
     this.trackingUrl = trackingURLProvider.getTrackingUrl();
+    this.amRegistrationHost = addressProvider.getLocalAddress();
 
     this.resourceManager = AMRMClientAsync.createAMRMClientAsync(yarnRMHeartbeatPeriod, this);
     this.nodeManager = new NMClientAsyncImpl(this);
@@ -334,10 +336,10 @@ final class YarnContainerManager implements AMRMClientAsync.CallbackHandler, NMC
           });
 
       LOG.log(Level.FINE, "YARN registration: register AM at \"{0}:{1}\" tracking URL \"{2}\"",
-          new Object[] {AM_REGISTRATION_HOST, AM_REGISTRATION_PORT, this.trackingUrl});
+          new Object[] {amRegistrationHost, AM_REGISTRATION_PORT, this.trackingUrl});
 
       this.registration.setRegistration(this.resourceManager.registerApplicationMaster(
-          AM_REGISTRATION_HOST, AM_REGISTRATION_PORT, this.trackingUrl));
+          amRegistrationHost, AM_REGISTRATION_PORT, this.trackingUrl));
 
       LOG.log(Level.FINE, "YARN registration: AM registered: {0}", this.registration);