tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeag...@apache.org
Subject tez git commit: TEZ-3175. Add tez client submit host (jeagles)
Date Fri, 18 Mar 2016 19:51:23 GMT
Repository: tez
Updated Branches:
  refs/heads/branch-0.7 8feb430cb -> 6823ab548


TEZ-3175. Add tez client submit host (jeagles)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/6823ab54
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/6823ab54
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/6823ab54

Branch: refs/heads/branch-0.7
Commit: 6823ab548a965dbe470a46d355b09f1612d8f1e9
Parents: 8feb430
Author: Jonathan Eagles <jeagles@yahoo-inc.com>
Authored: Fri Mar 18 14:51:10 2016 -0500
Committer: Jonathan Eagles <jeagles@yahoo-inc.com>
Committed: Fri Mar 18 14:51:10 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 .../main/java/org/apache/tez/client/TezClient.java   | 12 ++++++++++++
 .../org/apache/tez/dag/api/TezConfiguration.java     | 14 ++++++++++++++
 .../java/org/apache/tez/client/TestTezClient.java    | 15 +++++++++++++++
 4 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/6823ab54/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f894886..7723197 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -9,6 +9,7 @@ INCOMPATIBLE CHANGES
   TEZ-2972. Avoid task rescheduling when a node turns unhealthy
 
 ALL CHANGES:
+  TEZ-3175. Add tez client submit host
   TEZ-3166. Fix a few cases where counters aren't fully updated and sent for failed tasks.
Only adds tests.
   TEZ-2958. Recovered TA, whose commit cannot be recovered, should move to killed state
   TEZ-3105. TezMxBeanResourceCalculator does not work on IBM JDK 7 or 8 causing Tez failures.

http://git-wip-us.apache.org/repos/asf/tez/blob/6823ab54/tez-api/src/main/java/org/apache/tez/client/TezClient.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/TezClient.java b/tez-api/src/main/java/org/apache/tez/client/TezClient.java
index 3a857a0..56adf13 100644
--- a/tez-api/src/main/java/org/apache/tez/client/TezClient.java
+++ b/tez-api/src/main/java/org/apache/tez/client/TezClient.java
@@ -19,6 +19,8 @@
 package org.apache.tez.client;
 
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.text.NumberFormat;
 import java.util.HashMap;
 import java.util.Map;
@@ -152,6 +154,16 @@ public class TezClient {
     this.isSession = isSession;
     // Set in conf for local mode AM to figure out whether in session mode or not
     tezConf.setBoolean(TezConfiguration.TEZ_AM_SESSION_MODE, isSession);
+    try {
+      InetAddress ip = InetAddress.getLocalHost();
+      if (ip != null) {
+        tezConf.set(TezConfiguration.TEZ_SUBMIT_HOST, ip.getCanonicalHostName());
+        tezConf.set(TezConfiguration.TEZ_SUBMIT_HOST_ADDRESS, ip.getHostAddress());
+      }
+    } catch (UnknownHostException e) {
+      LOG.warn("The host name of the client the tez application was submitted from was unable
to be retrieved", e);
+    }
+
     this.amConfig = new AMConfiguration(tezConf, localResources, credentials);
     this.apiVersionInfo = new TezApiVersionInfo();
     Limits.setConfiguration(tezConf);

http://git-wip-us.apache.org/repos/asf/tez/blob/6823ab54/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java b/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java
index 7fef24e..ec0c3f8 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java
@@ -1017,6 +1017,20 @@ public class TezConfiguration extends Configuration {
   @ConfigurationScope(Scope.AM)
   public static final String TEZ_QUEUE_NAME = TEZ_PREFIX + "queue.name";
 
+  /**
+   * String value. Set automatically by the client. The host name of the client the Tez application
was submitted from.
+   */
+  @Private
+  @ConfigurationScope(Scope.AM)
+  public static final String TEZ_SUBMIT_HOST = TEZ_PREFIX + "submit.host";
+
+  /**
+   * String value. Set automatically by the client. The host address of the client the Tez
application was submitted from.
+   */
+  @Private
+  @ConfigurationScope(Scope.AM)
+  public static final String TEZ_SUBMIT_HOST_ADDRESS = TEZ_PREFIX + "submit.host.address";
+
   @Unstable
   /**
    * Boolean value. Generate debug artifacts like DAG plan in text format.

http://git-wip-us.apache.org/repos/asf/tez/blob/6823ab54/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java
----------------------------------------------------------------------
diff --git a/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java b/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java
index 2cd6a1a..60d63b3 100644
--- a/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java
+++ b/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java
@@ -19,6 +19,8 @@
 package org.apache.tez.client;
 
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -494,4 +496,17 @@ public class TestTezClient {
     client.start();
   }
 
+  @Test(timeout = 5000)
+  public void testSubmitHostPopulated() throws YarnException, IOException, ServiceException,
TezException {
+
+    TezConfiguration conf = new TezConfiguration();
+    configureAndCreateTezClient(conf);
+    InetAddress ip = InetAddress.getLocalHost();
+    if (ip != null) {
+      Assert.assertEquals(ip.getCanonicalHostName(), conf.get(TezConfiguration.TEZ_SUBMIT_HOST));
+      Assert.assertEquals(ip.getHostAddress(), conf.get(TezConfiguration.TEZ_SUBMIT_HOST_ADDRESS));
+    } else {
+      Assert.fail("Failed to retrieve local host information");
+    }
+  }
 }


Mime
View raw message