TEZ-3188. Move tez.submit.hosts out of TezConfiguration to
TezConfigurationConstants. (sseth)
diff --git a/CHANGES.txt b/CHANGES.txt
index 83fe420..d034c8c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,6 +10,7 @@
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 @@
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
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.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 @@
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);
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 @@
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 @@
@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.
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";
+
+}
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 @@
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.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 @@
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");
}