Repository: tez Updated Branches: refs/heads/master 2d58e2535 -> 52b732a77
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/52b732a7 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/52b732a7 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/52b732a7 Branch: refs/heads/master Commit: 52b732a77ad68a63f99a7b6aa8b4295d2ea945f2 Parents: 2d58e25 Author: Siddharth Seth <[email protected]> Authored: Fri Apr 8 10:14:17 2016 -0700 Committer: Siddharth Seth <[email protected]> Committed: Fri Apr 8 10:14:17 2016 -0700 ---------------------------------------------------------------------- CHANGES.txt | 2 + .../java/org/apache/tez/client/TezClient.java | 5 +- .../apache/tez/dag/api/TezConfiguration.java | 21 +++----- .../tez/dag/api/TezConfigurationConstants.java | 55 ++++++++++++++++++++ .../org/apache/tez/client/TestTezClient.java | 6 +-- 5 files changed, 69 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/52b732a7/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 83fe420..d034c8c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -10,6 +10,7 @@ INCOMPATIBLE CHANGES TEZ-3199. Rename getCredentials in TaskCommunicatorContext to be less confusing. ALL CHANGES: + TEZ-3188. Move tez.submit.hosts out of TezConfiguration to TezConfigurationConstants. TEZ-3194. Tez UI: Swimlane improve in-progress experience. TEZ-3196. java.lang.InternalError from decompression codec is fatal to a task during shuffle TEZ-3161. Allow task to report different kinds of errors - fatal / kill. @@ -425,6 +426,7 @@ INCOMPATIBLE CHANGES TEZ-2949. Allow duplicate dag names within session for Tez. 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/52b732a7/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 639d961..e6dd474 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 @@ -36,6 +36,7 @@ import org.apache.tez.common.JavaOptsChecker; import org.apache.tez.common.RPCUtil; import org.apache.tez.common.TezCommonUtils; import org.apache.tez.common.counters.Limits; +import org.apache.tez.dag.api.TezConfigurationConstants; import org.apache.tez.serviceplugins.api.ServicePluginsDescriptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -188,8 +189,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/52b732a7/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 924c7ff..0bbe1df 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 @@ -80,7 +80,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) { @@ -1106,20 +1111,6 @@ public class TezConfiguration extends Configuration { @ConfigurationScope(Scope.AM) public static final String TEZ_AM_APPLICATION_PRIORITY = TEZ_PREFIX + "am.application.priority"; - /** - * 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/52b732a7/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..33abc77 --- /dev/null +++ b/tez-api/src/main/java/org/apache/tez/dag/api/TezConfigurationConstants.java @@ -0,0 +1,55 @@ +/** + * 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; +import org.apache.tez.common.annotation.ConfigurationClass; +import org.apache.tez.common.annotation.ConfigurationProperty; + +/** + * Contains fields which will be set automatically by Tez in the Configuration + */ +@ConfigurationClass(templateFileName = "tez-conf-constants.xml") +@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) + @ConfigurationProperty + 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) + @ConfigurationProperty + public static final String TEZ_SUBMIT_HOST_ADDRESS = + TezConfiguration.TEZ_PREFIX + "submit.host.address"; + +} http://git-wip-us.apache.org/repos/asf/tez/blob/52b732a7/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 ae822f3..583fb79 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.nio.ByteBuffer; import java.util.Arrays; import java.util.Collections; @@ -69,6 +68,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.UserPayload; @@ -645,8 +645,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"); }
