You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2015/03/20 00:42:43 UTC
ambari git commit: AMBARI-10123. BE: provide
'property_value_attributes' in stacks configuration API (dsen via srimanth)
Repository: ambari
Updated Branches:
refs/heads/trunk 30bd08b51 -> 77f223215
AMBARI-10123. BE: provide 'property_value_attributes' in stacks configuration API (dsen via srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/77f22321
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/77f22321
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/77f22321
Branch: refs/heads/trunk
Commit: 77f223215cac59305e0718727c33f003ea3b884d
Parents: 30bd08b
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Mar 19 15:58:43 2015 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Mar 19 16:42:39 2015 -0700
----------------------------------------------------------------------
.../controller/StackConfigurationResponse.java | 75 +++++++-
.../StackLevelConfigurationResponse.java | 11 +-
.../StackConfigurationResourceProvider.java | 18 ++
...StackLevelConfigurationResourceProvider.java | 18 ++
.../apache/ambari/server/stack/StackModule.java | 42 +++++
.../server/state/PropertyDependencyInfo.java | 83 +++++++++
.../ambari/server/state/PropertyInfo.java | 51 +++++-
.../server/state/ValueAttributesInfo.java | 181 +++++++++++++++++++
.../configuration-mapred/mapred-site.xml | 88 ++++++++-
.../YARN/2.1.0.2.0/configuration/yarn-site.xml | 41 ++++-
.../src/main/resources/properties.json | 6 +
.../services/YARN/configuration/yarn-site.xml | 48 ++++-
.../server/api/services/AmbariMetaInfoTest.java | 25 +++
.../ambari/server/state/PropertyInfoTest.java | 5 +
.../services/YARN/configuration/yarn-site.xml | 23 +++
15 files changed, 704 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
index 9a7831e..7e1bfae 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
@@ -22,7 +22,10 @@ package org.apache.ambari.server.controller;
import java.util.Map;
import java.util.Set;
+import org.apache.ambari.server.state.PropertyDependencyInfo;
+import org.apache.ambari.server.state.PropertyInfo;
import org.apache.ambari.server.state.PropertyInfo.PropertyType;
+import org.apache.ambari.server.state.ValueAttributesInfo;
public class StackConfigurationResponse {
@@ -50,12 +53,20 @@ public class StackConfigurationResponse {
* @param propertyDescription Property Description
* @param type Configuration type
* @param isRequired Is required to be set
- * @param propertyType Property Type
+ * @param propertyTypes Property Types
* @param propertyAttributes Attributes map
+ * @param propertyValueAttributes Value Attributes
+ * @param dependsOnProperties depends on properties set
+ * @param dependedByProperties depended by properties set
*/
public StackConfigurationResponse(String propertyName, String propertyValue,
String propertyDescription, String type,
- Boolean isRequired, Set<PropertyType> propertyTypes, Map<String, String> propertyAttributes) {
+ Boolean isRequired,
+ Set<PropertyType> propertyTypes,
+ Map<String, String> propertyAttributes,
+ ValueAttributesInfo propertyValueAttributes,
+ Set<PropertyDependencyInfo> dependsOnProperties,
+ Set<PropertyDependencyInfo> dependedByProperties) {
setPropertyName(propertyName);
setPropertyValue(propertyValue);
setPropertyDescription(propertyDescription);
@@ -63,6 +74,9 @@ public class StackConfigurationResponse {
setRequired(isRequired);
setPropertyType(propertyTypes);
setPropertyAttributes(propertyAttributes);
+ setPropertyValueAttributes(propertyValueAttributes);
+ setDependsOnProperties(dependsOnProperties);
+ setDependedByProperties(dependedByProperties);
}
private String stackName;
@@ -73,6 +87,9 @@ public class StackConfigurationResponse {
private String propertyDescription;
private String type;
private Map<String, String> propertyAttributes;
+ private ValueAttributesInfo propertyValueAttributes;
+ private Set<PropertyDependencyInfo> dependsOnProperties;
+ private Set<PropertyDependencyInfo> dependedByProperties;
private Boolean isRequired;
private Set<PropertyType> propertyTypes;
@@ -155,6 +172,60 @@ public class StackConfigurationResponse {
}
/**
+ * Provides value attributes of this configuration.
+ *
+ * @return value attributes
+ */
+ public ValueAttributesInfo getPropertyValueAttributes() {
+ return propertyValueAttributes;
+ }
+
+ /**
+ * Sets value attributes for this configuration.
+ *
+ * @param propertyValueAttributes
+ */
+ public void setPropertyValueAttributes(ValueAttributesInfo propertyValueAttributes) {
+ this.propertyValueAttributes = propertyValueAttributes;
+ }
+
+ /**
+ * Provides depends on properties of this configuration.
+ *
+ * @return depends on properties set
+ */
+ public Set<PropertyDependencyInfo> getDependsOnProperties() {
+ return dependsOnProperties;
+ }
+
+ /**
+ * Sets depends on properties set for this configuration.
+ *
+ * @param dependsOnProperties
+ */
+ public void setDependsOnProperties(Set<PropertyDependencyInfo> dependsOnProperties) {
+ this.dependsOnProperties = dependsOnProperties;
+ }
+
+ /**
+ * Provides depended by properties of this configuration.
+ *
+ * @return depended by properties set
+ */
+ public Set<PropertyDependencyInfo> getDependedByProperties() {
+ return dependedByProperties;
+ }
+
+ /**
+ * Sets depended by properties set for this configuration.
+ *
+ * @param dependedByProperties
+ */
+ public void setDependedByProperties(Set<PropertyDependencyInfo> dependedByProperties) {
+ this.dependedByProperties = dependedByProperties;
+ }
+
+ /**
* Is property a isRequired property
* @return True/False
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java
index 151ce07..f1e0344 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java
@@ -22,15 +22,22 @@ package org.apache.ambari.server.controller;
import java.util.Map;
import java.util.Set;
+import org.apache.ambari.server.state.PropertyDependencyInfo;
+import org.apache.ambari.server.state.PropertyInfo;
import org.apache.ambari.server.state.PropertyInfo.PropertyType;
+import org.apache.ambari.server.state.ValueAttributesInfo;
public class StackLevelConfigurationResponse extends StackConfigurationResponse {
public StackLevelConfigurationResponse(String propertyName,
String propertyValue, String propertyDescription, String type,
Boolean isRequired, Set<PropertyType> propertyTypes,
- Map<String, String> propertyAttributes) {
+ Map<String, String> propertyAttributes,
+ ValueAttributesInfo propertyValueAttributes,
+ Set<PropertyDependencyInfo> dependsOnProperties,
+ Set<PropertyDependencyInfo> dependedByProperties) {
super(propertyName, propertyValue, propertyDescription, type, isRequired,
- propertyTypes, propertyAttributes);
+ propertyTypes, propertyAttributes, propertyValueAttributes,
+ dependsOnProperties, dependedByProperties);
}
public StackLevelConfigurationResponse(String propertyName, String propertyValue, String propertyDescription,
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProvider.java
index 4abf3d2..9707cbd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProvider.java
@@ -57,6 +57,15 @@ public class StackConfigurationResourceProvider extends
public static final String PROPERTY_VALUE_PROPERTY_ID = PropertyHelper
.getPropertyId("StackConfigurations", "property_value");
+ public static final String PROPERTY_VALUE_ATTRIBUTES_PROPERTY_ID = PropertyHelper
+ .getPropertyId("StackConfigurations", "property_value_attributes");
+
+ public static final String PROPERTY_DEPENDS_ON_PROPERTY_ID = PropertyHelper
+ .getPropertyId("StackConfigurations", "property_depends_on");
+
+ public static final String PROPERTY_DEPENDED_BY_PROPERTY_ID = PropertyHelper
+ .getPropertyId("StackConfigurations", "property_depended_by");
+
public static final String PROPERTY_DESCRIPTION_PROPERTY_ID = PropertyHelper
.getPropertyId("StackConfigurations", "property_description");
@@ -125,6 +134,15 @@ public class StackConfigurationResourceProvider extends
setResourceProperty(resource, PROPERTY_VALUE_PROPERTY_ID,
response.getPropertyValue(), requestedIds);
+ setResourceProperty(resource, PROPERTY_VALUE_ATTRIBUTES_PROPERTY_ID,
+ response.getPropertyValueAttributes(), requestedIds);
+
+ setResourceProperty(resource, PROPERTY_DEPENDS_ON_PROPERTY_ID,
+ response.getDependsOnProperties(), requestedIds);
+
+ setResourceProperty(resource, PROPERTY_DEPENDED_BY_PROPERTY_ID,
+ response.getDependedByProperties(), requestedIds);
+
setResourceProperty(resource, PROPERTY_DESCRIPTION_PROPERTY_ID,
response.getPropertyDescription(), requestedIds);
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProvider.java
index 1091bc7..f010b37 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProvider.java
@@ -54,6 +54,15 @@ public class StackLevelConfigurationResourceProvider extends
public static final String PROPERTY_VALUE_PROPERTY_ID = PropertyHelper
.getPropertyId("StackLevelConfigurations", "property_value");
+ public static final String PROPERTY_VALUE_ATTRIBUTES_PROPERTY_ID = PropertyHelper
+ .getPropertyId("StackConfigurations", "property_value_attributes");
+
+ public static final String DEPENDS_ON_PROPERTY_ID = PropertyHelper
+ .getPropertyId("StackConfigurations", "property_depends_on");
+
+ public static final String DEPENDED_BY_PROPERTY_ID = PropertyHelper
+ .getPropertyId("StackConfigurations", "property_depended_by");
+
public static final String PROPERTY_DESCRIPTION_PROPERTY_ID = PropertyHelper
.getPropertyId("StackLevelConfigurations", "property_description");
@@ -119,6 +128,15 @@ public class StackLevelConfigurationResourceProvider extends
setResourceProperty(resource, PROPERTY_VALUE_PROPERTY_ID,
response.getPropertyValue(), requestedIds);
+ setResourceProperty(resource, PROPERTY_VALUE_ATTRIBUTES_PROPERTY_ID,
+ response.getPropertyValueAttributes(), requestedIds);
+
+ setResourceProperty(resource, DEPENDS_ON_PROPERTY_ID,
+ response.getDependsOnProperties(), requestedIds);
+
+ setResourceProperty(resource, DEPENDED_BY_PROPERTY_ID,
+ response.getDependedByProperties(), requestedIds);
+
setResourceProperty(resource, PROPERTY_DESCRIPTION_PROPERTY_ID,
response.getPropertyDescription(), requestedIds);
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java
index 4181293..e0480c8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java
@@ -22,12 +22,15 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.state.PropertyDependencyInfo;
+import org.apache.ambari.server.state.PropertyInfo;
import org.apache.ambari.server.state.RepositoryInfo;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackInfo;
@@ -153,6 +156,7 @@ public class StackModule extends BaseModule<StackModule, StackInfo> implements V
mergeStackWithParent(parentVersion, allStacks, commonServices);
}
processRepositories();
+ processPropertyDependencies();
moduleState = ModuleState.RESOLVED;
}
@@ -574,6 +578,44 @@ public class StackModule extends BaseModule<StackModule, StackInfo> implements V
}
/**
+ * Process <depends-on></depends-on> properties
+ */
+ private void processPropertyDependencies() {
+
+ // Stack-definition has 'depends-on' relationship specified.
+ // We have a map to construct the 'depended-by' relationship.
+ Map<PropertyDependencyInfo, Set<PropertyDependencyInfo>> dependedByMap = new HashMap<PropertyDependencyInfo, Set<PropertyDependencyInfo>>();
+
+ // Go through all service-configs and gather the reversed 'depended-by'
+ // relationship into map. Since we do not have the reverse {@link PropertyInfo},
+ // we have to loop through service-configs again later.
+ for (ServiceModule serviceModule : serviceModules.values()) {
+ for (PropertyInfo pi : serviceModule.getModuleInfo().getProperties()) {
+ for (PropertyDependencyInfo pdi : pi.getDependsOnProperties()) {
+ PropertyDependencyInfo propertyDependency = new PropertyDependencyInfo(pi.getFilename(), pi.getName());
+ if (dependedByMap.keySet().contains(pdi)) {
+ dependedByMap.get(pdi).add(propertyDependency);
+ } else {
+ Set<PropertyDependencyInfo> newDependenciesSet = new HashSet<PropertyDependencyInfo>();
+ newDependenciesSet.add(propertyDependency);
+ dependedByMap.put(pdi, newDependenciesSet);
+ }
+ }
+ }
+ }
+
+ // Go through all service-configs again and set their 'depended-by' if necessary.
+ for (ServiceModule serviceModule : serviceModules.values()) {
+ for (PropertyInfo pi : serviceModule.getModuleInfo().getProperties()) {
+ Set<PropertyDependencyInfo> set = dependedByMap.remove(new PropertyDependencyInfo(pi.getFilename(), pi.getName()));
+ if (set != null) {
+ pi.getDependedByProperties().addAll(set);
+ }
+ }
+ }
+ }
+
+ /**
* Process repositories associated with the stack.
* @throws AmbariException if unable to fully process the stack repositories
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyDependencyInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyDependencyInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyDependencyInfo.java
new file mode 100644
index 0000000..9427dd5
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyDependencyInfo.java
@@ -0,0 +1,83 @@
+/**
+ * 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.ambari.server.state;
+
+
+public class PropertyDependencyInfo {
+
+ private String type;
+
+ private String name;
+
+ public PropertyDependencyInfo() {
+
+ }
+
+ public PropertyDependencyInfo(String type, String name) {
+ this.type = type;
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ PropertyDependencyInfo that = (PropertyDependencyInfo) o;
+
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ return false;
+ if (type != null ? !type.equals(that.type) : that.type != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = type != null ? type.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "PropertyDependencyInfo{" +
+ "type='" + type + '\'' +
+ ", name='" + name + '\'' +
+ '}';
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
index e26b48f..05bd637 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
@@ -25,6 +25,7 @@ import org.w3c.dom.Element;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlList;
import java.util.ArrayList;
@@ -47,6 +48,23 @@ public class PropertyInfo {
@XmlAnyElement
private List<Element> propertyAttributes = new ArrayList<Element>();
+ @XmlElement(name = "value-attributes")
+ private ValueAttributesInfo propertyValueAttributes =
+ new ValueAttributesInfo();
+
+ @XmlElementWrapper(name="depends-on")
+ @XmlElement(name = "property")
+ private Set<PropertyDependencyInfo> dependsOnProperties =
+ new HashSet<PropertyDependencyInfo>();
+
+ @XmlElementWrapper(name="property_depended_by")
+ private Set<PropertyDependencyInfo> dependedByProperties =
+ new HashSet<PropertyDependencyInfo>();
+
+ public PropertyInfo() {
+
+ }
+
public String getName() {
return name;
}
@@ -91,7 +109,9 @@ public class PropertyInfo {
public StackConfigurationResponse convertToResponse() {
return new StackConfigurationResponse(getName(), getValue(),
- getDescription() , getFilename(), isRequireInput(), getPropertyTypes(), getAttributesMap());
+ getDescription() , getFilename(), isRequireInput(), getPropertyTypes(),
+ getAttributesMap(), getPropertyValueAttributes(),
+ getDependsOnProperties(), getDependedByProperties());
}
public boolean isDeleted() {
@@ -110,6 +130,18 @@ public class PropertyInfo {
return attributes;
}
+ public ValueAttributesInfo getPropertyValueAttributes() {
+ return propertyValueAttributes;
+ }
+
+ public Set<PropertyDependencyInfo> getDependsOnProperties() {
+ return dependsOnProperties;
+ }
+
+ public Set<PropertyDependencyInfo> getDependedByProperties() {
+ return dependedByProperties;
+ }
+
@XmlAttribute(name = "require-input")
public boolean isRequireInput() {
return requireInput;
@@ -163,6 +195,23 @@ public class PropertyInfo {
return true;
}
+ @Override
+ public String toString() {
+ return "PropertyInfo{" +
+ "name='" + name + '\'' +
+ ", value='" + value + '\'' +
+ ", description='" + description + '\'' +
+ ", filename='" + filename + '\'' +
+ ", deleted=" + deleted +
+ ", requireInput=" + requireInput +
+ ", propertyTypes=" + propertyTypes +
+ ", propertyAttributes=" + propertyAttributes +
+ ", propertyValueAttributes=" + propertyValueAttributes +
+ ", dependsOnProperties=" + dependsOnProperties +
+ ", dependedByProperties=" + dependedByProperties +
+ '}';
+ }
+
public enum PropertyType {
PASSWORD,
USER,
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
new file mode 100644
index 0000000..c17a40d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
@@ -0,0 +1,181 @@
+/**
+ * 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.ambari.server.state;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import java.util.Arrays;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+public class ValueAttributesInfo {
+ private String type;
+ private String maximum;
+ private String minimum;
+ private String unit;
+ private String[] entries;
+
+ @XmlElement(name = "entry_labels")
+ private String[] entryLabels;
+
+ @XmlElement(name = "entry_descriptions")
+ private String[] entryDescriptions;
+
+ @XmlElement(name = "entries_editable")
+ private Boolean entriesEditable;
+
+ @XmlElement(name = "selection_cardinality")
+ private String selectionCardinality;
+
+ public ValueAttributesInfo() {
+
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getMaximum() {
+ return maximum;
+ }
+
+ public void setMaximum(String maximum) {
+ this.maximum = maximum;
+ }
+
+ public String getMinimum() {
+ return minimum;
+ }
+
+ public void setMinimum(String minimum) {
+ this.minimum = minimum;
+ }
+
+ public String getUnit() {
+ return unit;
+ }
+
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
+
+ public String[] getEntries() {
+ return entries;
+ }
+
+ public void setEntries(String[] entries) {
+ this.entries = entries;
+ }
+
+ public String[] getEntryLabels() {
+ return entryLabels;
+ }
+
+ public void setEntryLabels(String[] entryLabels) {
+ this.entryLabels = entryLabels;
+ }
+
+ public String[] getEntryDescriptions() {
+ return entryDescriptions;
+ }
+
+ public void setEntryDescriptions(String[] entryDescriptions) {
+ this.entryDescriptions = entryDescriptions;
+ }
+
+ public Boolean getEntriesEditable() {
+ return entriesEditable;
+ }
+
+ public void setEntriesEditable(Boolean entriesEditable) {
+ this.entriesEditable = entriesEditable;
+ }
+
+ public String getSelectionCardinality() {
+ return selectionCardinality;
+ }
+
+ public void setSelectionCardinality(String selectionCardinality) {
+ this.selectionCardinality = selectionCardinality;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ValueAttributesInfo that = (ValueAttributesInfo) o;
+
+ if (!Arrays.equals(entries, that.entries)) return false;
+ if (entriesEditable != null ? !entriesEditable.equals(that.entriesEditable) : that.entriesEditable != null)
+ return false;
+ if (!Arrays.equals(entryDescriptions, that.entryDescriptions))
+ return false;
+ if (!Arrays.equals(entryLabels, that.entryLabels)) return false;
+ if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null)
+ return false;
+ if (minimum != null ? !minimum.equals(that.minimum) : that.minimum != null)
+ return false;
+ if (selectionCardinality != null ? !selectionCardinality.equals(that.selectionCardinality) : that.selectionCardinality != null)
+ return false;
+ if (type != null ? !type.equals(that.type) : that.type != null)
+ return false;
+ if (unit != null ? !unit.equals(that.unit) : that.unit != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = type != null ? type.hashCode() : 0;
+ result = 31 * result + (maximum != null ? maximum.hashCode() : 0);
+ result = 31 * result + (minimum != null ? minimum.hashCode() : 0);
+ result = 31 * result + (unit != null ? unit.hashCode() : 0);
+ result = 31 * result + (entries != null ? Arrays.hashCode(entries) : 0);
+ result = 31 * result + (entryLabels != null ? Arrays.hashCode(entryLabels) : 0);
+ result = 31 * result + (entryDescriptions != null ? Arrays.hashCode(entryDescriptions) : 0);
+ result = 31 * result + (entriesEditable != null ? entriesEditable.hashCode() : 0);
+ result = 31 * result + (selectionCardinality != null ? selectionCardinality.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "ValueAttributesInfo{" +
+ "type='" + type + '\'' +
+ ", maximum=" + maximum +
+ ", minimum=" + minimum +
+ ", unit='" + unit + '\'' +
+ ", entries=" + Arrays.toString(entries) +
+ ", entryLabels=" + Arrays.toString(entryLabels) +
+ ", entryDescriptions=" + Arrays.toString(entryDescriptions) +
+ ", entriesEditable=" + entriesEditable +
+ ", selectionCardinality='" + selectionCardinality + '\'' +
+ '}';
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
index 7955cb2..3586f2d 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
@@ -26,11 +26,24 @@
<property>
<name>mapreduce.task.io.sort.mb</name>
- <value>200</value>
+ <value>358</value>
<description>
The total amount of buffer memory to use while sorting files, in megabytes.
By default, gives each merge stream 1MB, which should minimize seeks.
</description>
+ <display-name>MapReduce Sort Allocation</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ <maximum>2047</maximum>
+ <unit>MB</unit>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>mapred-site.xml</type>
+ <name>mapreduce.map.memory.mb</name>
+ </property>
+ </depends-on>
</property>
<property>
@@ -160,14 +173,40 @@
<property>
<name>mapreduce.map.memory.mb</name>
- <value>1024</value>
+ <value>512</value>
<description>Virtual memory for single Map task</description>
+ <display-name>MR Map RAM Allocation</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>512</minimum>
+ <maximum>5120</maximum>
+ <unit>MB</unit>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>yarn-site.xml</type>
+ <name>yarn.scheduler.maximum-allocation-mb</name>
+ </property>
+ </depends-on>
</property>
<property>
<name>mapreduce.reduce.memory.mb</name>
<value>1024</value>
<description>Virtual memory for single Reduce task</description>
+ <display-name>MR Reduce RAM Allocation</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>512</minimum>
+ <maximum>5120</maximum>
+ <unit>MB</unit>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>yarn-site.xml</type>
+ <name>yarn.scheduler.maximum-allocation-mb</name>
+ </property>
+ </depends-on>
</property>
<property>
@@ -229,11 +268,24 @@
<name>yarn.app.mapreduce.am.resource.mb</name>
<value>512</value>
<description>The amount of memory the MR AppMaster needs.</description>
+ <display-name>MR AppMaster RAM Allocation </display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>512</minimum>
+ <maximum>5120</maximum>
+ <unit>MB</unit>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>yarn-site.xml</type>
+ <name>yarn.scheduler.maximum-allocation-mb</name>
+ </property>
+ </depends-on>
</property>
<property>
<name>yarn.app.mapreduce.am.command-opts</name>
- <value>-Xmx312m</value>
+ <value>-Xmx410m</value>
<description>
Java opts for the MR App Master processes.
The following symbol, if present, will be interpolated: @taskid@ is replaced
@@ -247,6 +299,13 @@
of LD_LIBRARY_PATH in the map / reduce JVM env using the mapreduce.map.env and
mapreduce.reduce.env config settings.
</description>
+ <display-name>MR AppMaster Java Heap Size</display-name>
+ <depends-on>
+ <property>
+ <type>mapred-site.xml</type>
+ <name>yarn.app.mapreduce.am.resource.mb</name>
+ </property>
+ </depends-on>
</property>
<property>
@@ -262,6 +321,13 @@
of LD_LIBRARY_PATH in the map / reduce JVM env using the mapreduce.map.env and
mapreduce.reduce.env config settings.
</description>
+ <display-name>MR AppMaster Java Heap Size</display-name>
+ <depends-on>
+ <property>
+ <type>mapred-site.xml</type>
+ <name>yarn.app.mapreduce.am.resource.mb</name>
+ </property>
+ </depends-on>
</property>
<property>
@@ -306,10 +372,17 @@
<property>
<name>mapreduce.map.java.opts</name>
- <value>-Xmx756m</value>
+ <value>-Xmx410m</value>
<description>
Larger heap-size for child jvms of maps.
</description>
+ <display-name>MR Map Java Heap Size</display-name>
+ <depends-on>
+ <property>
+ <type>mapred-site.xml</type>
+ <name>mapreduce.map.memory.mb</name>
+ </property>
+ </depends-on>
</property>
@@ -319,6 +392,13 @@
<description>
Larger heap-size for child jvms of reduces.
</description>
+ <display-name>MR Reduce Java Heap Size</display-name>
+ <depends-on>
+ <property>
+ <type>mapred-site.xml</type>
+ <name>mapreduce.reduce.memory.mb</name>
+ </property>
+ </depends-on>
</property>
<property>
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
index 3df629d..aceee50 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-site.xml
@@ -70,16 +70,42 @@
in MBs. Memory requests lower than this won't take effect,
and the specified value will get allocated at minimum.
</description>
+ <display-name>YARN Container Minimum RAM</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ <maximum>5120</maximum>
+ <unit>MB</unit>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>yarn-site.xml</type>
+ <name>yarn.nodemanager.resource.memory-mb</name>
+ </property>
+ </depends-on>
</property>
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
- <value>2048</value>
+ <value>5120</value>
<description>
The maximum allocation for every container request at the RM,
in MBs. Memory requests higher than this won't take effect,
and will get capped to this value.
</description>
+ <display-name>YARN Container Maximum RAM</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ <maximum>5120</maximum>
+ <unit>MB</unit>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>yarn-site.xml</type>
+ <name>yarn.nodemanager.resource.memory-mb</name>
+ </property>
+ </depends-on>
</property>
<property>
@@ -107,6 +133,13 @@
<value>5120</value>
<description>Amount of physical memory, in MB, that can be allocated
for containers.</description>
+ <display-name>Total NM Physical Memory Available to Containers</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ <maximum>268435456</maximum>
+ <unit>MB</unit>
+ </value-attributes>
</property>
<property>
@@ -123,6 +156,12 @@
expressed in terms of physical memory, and virtual memory usage
is allowed to exceed this allocation by this ratio.
</description>
+ <display-name>Virtual Memory Ratio</display-name>
+ <value-attributes>
+ <type>float</type>
+ <minimum>0.1</minimum>
+ <maximum>5.0</maximum>
+ </value-attributes>
</property>
<property>
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index cdb2bd6..4fee882 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -231,6 +231,9 @@
"StackConfigurations/service_name",
"StackConfigurations/property_name",
"StackConfigurations/property_value",
+ "StackConfigurations/property_value_attributes",
+ "StackConfigurations/property_depends_on",
+ "StackConfigurations/property_depended_by",
"StackConfigurations/property_description",
"StackConfigurations/type",
"StackConfigurations/final",
@@ -420,6 +423,9 @@
"StackLevelConfigurations/stack_version",
"StackLevelConfigurations/property_name",
"StackLevelConfigurations/property_value",
+ "StackLevelConfigurations/property_value_attributes",
+ "StackLevelConfigurations/property_depends_on",
+ "StackLevelConfigurations/property_depended_by",
"StackLevelConfigurations/property_description",
"StackLevelConfigurations/type",
"StackLevelConfigurations/final",
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
index 94b5304..d562246 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
@@ -183,11 +183,23 @@
<name>yarn.nodemanager.resource.cpu-vcores</name>
<value>8</value>
<description></description>
+ <display-name>Total NM CPU vCores available to Containers</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ <maximum>32</maximum>
+ </value-attributes>
</property>
<property>
<name>yarn.nodemanager.resource.percentage-physical-cpu-limit</name>
- <value>100</value>
+ <value>80</value>
<description>The amount of CPU allocated for YARN containers - only effective when used with CGroups</description>
+ <display-name>% of Total NM CPU available to Containers</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ <maximum>100</maximum>
+ </value-attributes>
</property>
<property>
<name>yarn.node-labels.manager-class</name>
@@ -323,4 +335,38 @@
<value>/system/yarn/node-labels</value>
<description></description>
</property>
+ <property>
+ <name>yarn.scheduler.minimum-allocation-vcores</name>
+ <value>1</value>
+ <description></description>
+ <display-name>YARN Container Minimum vCores</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ <maximum>8</maximum>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>yarn-site.xml</type>
+ <name>yarn.nodemanager.resource.cpu-vcores</name>
+ </property>
+ </depends-on>
+ </property>
+ <property>
+ <name>yarn.scheduler.maximum-allocation-vcores</name>
+ <value>8</value>
+ <description></description>
+ <display-name>YARN Container Maximum vCores</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ <maximum>8</maximum>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>yarn-site.xml</type>
+ <name>yarn.nodemanager.resource.cpu-vcores</name>
+ </property>
+ </depends-on>
+ </property>
</configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index c7878db..8f7c199 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -64,6 +64,7 @@ import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.CustomCommandDefinition;
import org.apache.ambari.server.state.DependencyInfo;
import org.apache.ambari.server.state.OperatingSystemInfo;
+import org.apache.ambari.server.state.PropertyDependencyInfo;
import org.apache.ambari.server.state.PropertyInfo;
import org.apache.ambari.server.state.RepositoryInfo;
import org.apache.ambari.server.state.ServiceInfo;
@@ -737,8 +738,12 @@ public class AmbariMetaInfoTest {
PropertyInfo redefinedProperty3 = null;
PropertyInfo inheritedProperty = null;
PropertyInfo newProperty = null;
+ PropertyInfo newEnhancedProperty = null;
PropertyInfo originalProperty = null;
+ PropertyDependencyInfo propertyDependencyInfo =
+ new PropertyDependencyInfo("yarn-site.xml", "new-enhanced-yarn-property");
+
for (PropertyInfo propertyInfo : redefinedService.getProperties()) {
if (propertyInfo.getName().equals("yarn.resourcemanager.resource-tracker.address")) {
deleteProperty1 = propertyInfo;
@@ -754,6 +759,8 @@ public class AmbariMetaInfoTest {
inheritedProperty = propertyInfo;
} else if (propertyInfo.getName().equals("new-yarn-property")) {
newProperty = propertyInfo;
+ } else if (propertyInfo.getName().equals("new-enhanced-yarn-property")) {
+ newEnhancedProperty = propertyInfo;
} else if (propertyInfo.getName().equals("yarn.nodemanager.aux-services")) {
originalProperty = propertyInfo;
}
@@ -776,6 +783,24 @@ public class AmbariMetaInfoTest {
Assert.assertEquals("some-value", newProperty.getValue());
Assert.assertEquals("some description.", newProperty.getDescription());
Assert.assertEquals("yarn-site.xml", newProperty.getFilename());
+ Assert.assertEquals(1, newProperty.getDependedByProperties().size());
+ Assert.assertTrue(newProperty.getDependedByProperties().contains(propertyDependencyInfo));
+ // New enhanced property
+ Assert.assertNotNull(newEnhancedProperty);
+ Assert.assertEquals("1024", newEnhancedProperty.getValue());
+ Assert.assertEquals("some enhanced description.", newEnhancedProperty.getDescription());
+ Assert.assertEquals("yarn-site.xml", newEnhancedProperty.getFilename());
+ Assert.assertEquals(2, newEnhancedProperty.getDependsOnProperties().size());
+ Assert.assertTrue(newEnhancedProperty.getDependsOnProperties().contains(new PropertyDependencyInfo("yarn-site.xml", "new-yarn-property")));
+ Assert.assertTrue(newEnhancedProperty.getDependsOnProperties().contains(new PropertyDependencyInfo("global.xml", "yarn_heapsize")));
+ Assert.assertEquals("MB", newEnhancedProperty.getPropertyValueAttributes().getUnit());
+ Assert.assertEquals("int", newEnhancedProperty.getPropertyValueAttributes().getType());
+ Assert.assertEquals("512", newEnhancedProperty.getPropertyValueAttributes().getMinimum());
+ Assert.assertEquals("15360", newEnhancedProperty.getPropertyValueAttributes().getMaximum());
+ Assert.assertNull(newEnhancedProperty.getPropertyValueAttributes().getEntries());
+ Assert.assertNull(newEnhancedProperty.getPropertyValueAttributes().getEntriesEditable());
+ Assert.assertNull(newEnhancedProperty.getPropertyValueAttributes().getEntryDescriptions());
+ Assert.assertNull(newEnhancedProperty.getPropertyValueAttributes().getEntryLabels());
// Original property
Assert.assertNotNull(originalProperty);
Assert.assertEquals("mapreduce.shuffle", originalProperty.getValue());
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
index e8a2a8d..31cf80b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
@@ -43,11 +43,16 @@ public class PropertyInfoTest {
property.setValue("value");
property.setDescription("desc");
property.setFilename("filename");
+ PropertyDependencyInfo pdi = new PropertyDependencyInfo("type", "name");
+ property.getDependsOnProperties().add(pdi);
assertEquals("name", property.getName());
assertEquals("value", property.getValue());
assertEquals("desc", property.getDescription());
assertEquals("filename", property.getFilename());
+
+ assertEquals(1, property.getDependsOnProperties().size());
+ assertTrue(property.getDependsOnProperties().contains(pdi));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f22321/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/configuration/yarn-site.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/configuration/yarn-site.xml
index 59b5245..de723a3 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/configuration/yarn-site.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/configuration/yarn-site.xml
@@ -57,4 +57,27 @@
<description>some description.</description>
</property>
+ <property>
+ <name>new-enhanced-yarn-property</name>
+ <value>1024</value>
+ <description>some enhanced description.</description>
+ <value-attributes>
+ <type>int</type>
+ <minimum>512</minimum>
+ <maximum>15360</maximum>
+ <unit>MB</unit>
+ </value-attributes>
+ <depends-on>
+ <property>
+ <type>yarn-site.xml</type>
+ <name>new-yarn-property</name>
+ </property>
+ <property>
+ <type>global.xml</type>
+ <name>yarn_heapsize</name>
+ </property>
+ </depends-on>
+ </property>
+
+
</configuration>