use of alluxio.conf.AlluxioProperties in project alluxio by Alluxio.
the class MountInfo method toDisplayMountPointInfo.
/**
* @return the {@link MountPointInfo} for the mount point. Some information is formatted
* for display purpose.
*/
public MountPointInfo toDisplayMountPointInfo() {
MountPointInfo info = toMountPointInfo();
UnderFileSystemConfiguration conf = UnderFileSystemConfiguration.defaults(new InstancedConfiguration(new AlluxioProperties())).createMountSpecificConf(info.getProperties());
Map<String, String> displayConf = conf.toUserPropertyMap(ConfigurationValueOptions.defaults().useDisplayValue(true));
info.setProperties(displayConf);
return info;
}
use of alluxio.conf.AlluxioProperties in project alluxio by Alluxio.
the class JobUtils method loadThroughRead.
private static void loadThroughRead(URIStatus status, FileSystemContext context, long blockId, AlluxioConfiguration conf) throws IOException {
// This does not work for remote worker unless we have passive cache on.
AlluxioProperties prop = context.getClusterConf().copyProperties();
prop.set(PropertyKey.USER_FILE_PASSIVE_CACHE_ENABLED, true);
AlluxioConfiguration config = new InstancedConfiguration(prop);
FileSystemContext loadContext = FileSystemContext.create(config);
AlluxioBlockStore blockStore = AlluxioBlockStore.create(loadContext);
OpenFilePOptions openOptions = OpenFilePOptions.newBuilder().setReadType(ReadPType.CACHE).build();
InStreamOptions inOptions = new InStreamOptions(status, openOptions, conf);
inOptions.setUfsReadLocationPolicy(BlockLocationPolicy.Factory.create(LocalFirstPolicy.class.getCanonicalName(), conf));
BlockInfo info = Preconditions.checkNotNull(status.getBlockInfo(blockId));
try (InputStream inputStream = blockStore.getInStream(info, inOptions, ImmutableMap.of())) {
while (inputStream.read(sIgnoredReadBuf) != -1) {
}
}
}
use of alluxio.conf.AlluxioProperties in project alluxio by Alluxio.
the class LocalCacheManagerIntegrationTest method before.
@Before
public void before() throws Exception {
mConf = new InstancedConfiguration(new AlluxioProperties());
mConf.set(PropertyKey.USER_CLIENT_CACHE_PAGE_SIZE, PAGE_SIZE_BYTES);
mConf.set(PropertyKey.USER_CLIENT_CACHE_SIZE, CACHE_SIZE_BYTES);
mConf.set(PropertyKey.USER_CLIENT_CACHE_ENABLED, true);
mConf.set(PropertyKey.USER_CLIENT_CACHE_DIR, mTemp.getRoot().getPath());
mConf.set(PropertyKey.USER_CLIENT_CACHE_ASYNC_WRITE_ENABLED, false);
mConf.set(PropertyKey.USER_CLIENT_CACHE_ASYNC_RESTORE_ENABLED, false);
mConf.set(PropertyKey.USER_CLIENT_CACHE_STORE_OVERHEAD, 0);
}
use of alluxio.conf.AlluxioProperties in project alluxio by Alluxio.
the class ManagerProcessContext method getUpdatedProps.
/**
* Get updated cluster configuration from the configuration set.
*
* @param configSet cluster config set
* @return Alluxio configuration
*/
public AlluxioConfiguration getUpdatedProps(AlluxioConfigurationSet configSet) {
if (!configSet.hasSiteProperties()) {
return ServerConfiguration.global();
}
Properties props = ConfigurationUtils.loadProperties(new ByteArrayInputStream(configSet.getSiteProperties().getBytes()));
AlluxioProperties alluxioProperties = ConfigurationUtils.defaults().copy();
alluxioProperties.merge(props, CLUSTER_DEFAULT);
return new InstancedConfiguration(alluxioProperties);
}
use of alluxio.conf.AlluxioProperties in project alluxio by Alluxio.
the class ConfigurationUtils method getClusterConf.
/**
* Loads the cluster level configuration from the get configuration response,
* filters out the configuration for certain scope, and merges it with the existing configuration.
*
* @param response the get configuration RPC response
* @param conf the existing configuration
* @param scope the target scope
* @return the merged configuration
*/
public static AlluxioConfiguration getClusterConf(GetConfigurationPResponse response, AlluxioConfiguration conf, Scope scope) {
String clientVersion = conf.getString(PropertyKey.VERSION);
LOG.debug("Alluxio {} (version {}) is trying to load cluster level configurations", scope, clientVersion);
List<alluxio.grpc.ConfigProperty> clusterConfig = response.getClusterConfigsList();
Properties clusterProps = filterAndLoadProperties(clusterConfig, scope, (key, value) -> String.format("Loading property: %s (%s) -> %s", key, key.getScope(), value));
// Check version.
String clusterVersion = clusterProps.get(PropertyKey.VERSION).toString();
if (!clientVersion.equals(clusterVersion)) {
LOG.warn("Alluxio {} version ({}) does not match Alluxio cluster version ({})", scope, clientVersion, clusterVersion);
clusterProps.remove(PropertyKey.VERSION);
}
// Merge conf returned by master as the cluster default into conf object
AlluxioProperties props = conf.copyProperties();
props.merge(clusterProps, Source.CLUSTER_DEFAULT);
// Use the constructor to set cluster defaults as being loaded.
InstancedConfiguration updatedConf = new InstancedConfiguration(props, true);
updatedConf.validate();
LOG.debug("Alluxio {} has loaded cluster level configurations", scope);
return updatedConf;
}
Aggregations