/** * Merges Hadoop {@link org.apache.hadoop.conf.Configuration} into the Alluxio configuration. * * @param source the {@link org.apache.hadoop.conf.Configuration} to merge * @param alluxioConfiguration the Alluxio configuration to merge to */ public static void mergeHadoopConfiguration(org.apache.hadoop.conf.Configuration source, AlluxioConfiguration alluxioConfiguration) { // Load Alluxio configuration if any and merge to the one in Alluxio file system // Push Alluxio configuration to the Job configuration Properties alluxioConfProperties = new Properties(); // Load any Alluxio configuration parameters existing in the Hadoop configuration. for (Map.Entry<String, String> entry : source) { String propertyName = entry.getKey(); if (PropertyKey.isValid(propertyName)) { alluxioConfProperties.put(propertyName, entry.getValue()); } } LOG.info("Loading Alluxio properties from Hadoop configuration: {}", alluxioConfProperties); // Merge the relevant Hadoop configuration into Alluxio's configuration. // TODO(jiri): support multiple client configurations (ALLUXIO-2034) alluxioConfiguration.merge(alluxioConfProperties, Source.RUNTIME); alluxioConfiguration.validate(); } }
/** * Gets the property key if the property name matches the template. * * @param propertyName name of the property * @return the property key, or null if the property name does not match the template */ @Nullable private PropertyKey getPropertyKey(String propertyName) { Matcher matcher = match(propertyName); if (!matcher.matches()) { return null; } // if the template can extract a nested property, build the new property from the nested one String nestedKeyName = null; try { nestedKeyName = matcher.group(NESTED_GROUP); } catch (IllegalArgumentException e) { // ignore if group is not found } PropertyKey nestedProperty = null; if (nestedKeyName != null && isValid(nestedKeyName)) { nestedProperty = fromString(nestedKeyName); } return mPropertyCreator.apply(propertyName, nestedProperty); } }
throw new RuntimeException("Circular dependency found while resolving " + match); if (!PropertyKey.isValid(match)) { throw new RuntimeException("Invalid property key " + match);
String value = entry.getValue() == null ? null : entry.getValue().toString().trim(); PropertyKey propertyKey; if (PropertyKey.isValid(key)) { propertyKey = PropertyKey.fromString(key); } else {
private static PropertyKey toPropertyKey(String name) { if (PropertyKey.isValid(name)) { return PropertyKey.fromString(name); } else { // Worker might have properties that the master doesn't yet know about, e.g. UFS specific // properties, or properties from a different version of Alluxio. return new PropertyKey.Builder(name).setIsBuiltIn(false).buildUnregistered(); } }
if (!PropertyKey.isValid(propertyName)) { continue;
/** * Gets all global configuration properties filtered by the specified scope. * * @param scope the scope to filter by * @return the properties */ public static List<ConfigProperty> getConfiguration(Scope scope) { ConfigurationValueOptions useRawDisplayValue = ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(true); return Configuration.keySet().stream() .filter(key -> key.getScope().contains(scope)) .filter(key -> key.isValid(key.getName())) .map(key -> new ConfigProperty() .setName(key.getName()) .setSource(Configuration.getSource(key).toString()).setValue( Configuration.isSet(key) ? Configuration.get(key, useRawDisplayValue) : null)) .collect(toList()); }
String name = property.getName(); if (PropertyKey.isValid(name) && property.getValue() != null) { PropertyKey key = PropertyKey.fromString(name); if (!key.getScope().contains(Scope.CLIENT)) {