Return-Path: X-Original-To: apmail-tez-commits-archive@minotaur.apache.org Delivered-To: apmail-tez-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 96A3418823 for ; Fri, 18 Mar 2016 19:51:23 +0000 (UTC) Received: (qmail 15322 invoked by uid 500); 18 Mar 2016 19:51:23 -0000 Delivered-To: apmail-tez-commits-archive@tez.apache.org Received: (qmail 15282 invoked by uid 500); 18 Mar 2016 19:51:23 -0000 Mailing-List: contact commits-help@tez.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tez.apache.org Delivered-To: mailing list commits@tez.apache.org Received: (qmail 15273 invoked by uid 99); 18 Mar 2016 19:51:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2016 19:51:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 238C7DFA40; Fri, 18 Mar 2016 19:51:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jeagles@apache.org To: commits@tez.apache.org Message-Id: <4737d19d867845b8aee4a7cbb0f4a024@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: tez git commit: TEZ-3175. Add tez client submit host (jeagles) Date: Fri, 18 Mar 2016 19:51:23 +0000 (UTC) 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 Authored: Fri Mar 18 14:51:10 2016 -0500 Committer: Jonathan Eagles 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"); + } + } }