Repository: tez Updated Branches: refs/heads/branch-0.7 ad3065134 -> 81b716626
TEZ-3188. Move tez.submit.hosts out of TezConfiguration to TezConfigurationConstants. (sseth) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/81b71662 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/81b71662 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/81b71662 Branch: refs/heads/branch-0.7 Commit: 81b71662637ffe5e7611e5e476e7f5c48914751f Parents: ad30651 Author: Siddharth Seth <[email protected]> Authored: Fri Apr 8 10:13:03 2016 -0700 Committer: Siddharth Seth <[email protected]> Committed: Fri Apr 8 10:13:03 2016 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../java/org/apache/tez/client/TezClient.java | 5 +- .../apache/tez/dag/api/TezConfiguration.java | 21 +++----- .../tez/dag/api/TezConfigurationConstants.java | 50 ++++++++++++++++++++ .../org/apache/tez/client/TestTezClient.java | 6 +-- 5 files changed, 63 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/81b71662/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 77d0b5d..38bc67e 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-3188. Move tez.submit.hosts out of TezConfiguration to TezConfigurationConstants. TEZ-3196. java.lang.InternalError from decompression codec is fatal to a task during shuffle TEZ-3177. Non-DAG events should use the session domain or no domain if the data does not need protection. TEZ-3192. IFile#checkState creating unnecessary objects though auto-boxing http://git-wip-us.apache.org/repos/asf/tez/blob/81b71662/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 e8c1760..2cdc86e 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 @@ -44,6 +44,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.tez.common.counters.Limits; +import org.apache.tez.dag.api.TezConfigurationConstants; import org.apache.tez.common.JavaOptsChecker; import org.apache.tez.common.ReflectionUtils; import org.apache.tez.common.RPCUtil; @@ -158,8 +159,8 @@ public class TezClient { 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()); + tezConf.set(TezConfigurationConstants.TEZ_SUBMIT_HOST, ip.getCanonicalHostName()); + tezConf.set(TezConfigurationConstants.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); http://git-wip-us.apache.org/repos/asf/tez/blob/81b71662/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 ec0c3f8..896dfb6 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 @@ -75,7 +75,12 @@ public class TezConfiguration extends Configuration { Configuration.addDeprecation("tez.task.max-events-per-heartbeat.max", TezConfiguration.TEZ_TASK_MAX_EVENTS_PER_HEARTBEAT); - for (Field field : TezConfiguration.class.getFields()) { + setupConfigurationScope(TezConfiguration.class); + + } + + static void setupConfigurationScope(Class<?> clazz) { + for (Field field : clazz.getFields()) { if (field.isAnnotationPresent(ConfigurationScope.class)) { ConfigurationScope confScope = field.getAnnotation(ConfigurationScope.class); if (field.getType() == String.class) { @@ -1017,20 +1022,6 @@ 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/81b71662/tez-api/src/main/java/org/apache/tez/dag/api/TezConfigurationConstants.java ---------------------------------------------------------------------- diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/TezConfigurationConstants.java b/tez-api/src/main/java/org/apache/tez/dag/api/TezConfigurationConstants.java new file mode 100644 index 0000000..2551fcc --- /dev/null +++ b/tez-api/src/main/java/org/apache/tez/dag/api/TezConfigurationConstants.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tez.dag.api; + +import org.apache.hadoop.classification.InterfaceAudience.Private; + +/** + * Contains fields which will be set automatically by Tez in the Configuration + */ +@Private +public class TezConfigurationConstants { + + static { + TezConfiguration.setupConfigurationScope(TezConfigurationConstants.class); + } + + /** + * 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 = TezConfiguration.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 = + TezConfiguration.TEZ_PREFIX + "submit.host.address"; + +} http://git-wip-us.apache.org/repos/asf/tez/blob/81b71662/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 60d63b3..c84df29 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 @@ -20,7 +20,6 @@ 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; @@ -59,6 +58,7 @@ import org.apache.tez.dag.api.PreWarmVertex; import org.apache.tez.dag.api.ProcessorDescriptor; import org.apache.tez.dag.api.SessionNotRunning; import org.apache.tez.dag.api.TezConfiguration; +import org.apache.tez.dag.api.TezConfigurationConstants; import org.apache.tez.dag.api.TezConstants; import org.apache.tez.dag.api.TezException; import org.apache.tez.dag.api.Vertex; @@ -503,8 +503,8 @@ public class TestTezClient { 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)); + Assert.assertEquals(ip.getCanonicalHostName(), conf.get(TezConfigurationConstants.TEZ_SUBMIT_HOST)); + Assert.assertEquals(ip.getHostAddress(), conf.get(TezConfigurationConstants.TEZ_SUBMIT_HOST_ADDRESS)); } else { Assert.fail("Failed to retrieve local host information"); }
