Search in sources :

Example 6 with AlluxioProperties

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;
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioProperties(alluxio.conf.AlluxioProperties) MountPointInfo(alluxio.wire.MountPointInfo) UnderFileSystemConfiguration(alluxio.underfs.UnderFileSystemConfiguration)

Example 7 with AlluxioProperties

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) {
        }
    }
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioProperties(alluxio.conf.AlluxioProperties) BlockInfo(alluxio.wire.BlockInfo) FileBlockInfo(alluxio.wire.FileBlockInfo) InputStream(java.io.InputStream) FileSystemContext(alluxio.client.file.FileSystemContext) AlluxioBlockStore(alluxio.client.block.AlluxioBlockStore) OpenFilePOptions(alluxio.grpc.OpenFilePOptions) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) InStreamOptions(alluxio.client.file.options.InStreamOptions)

Example 8 with AlluxioProperties

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);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioProperties(alluxio.conf.AlluxioProperties) Before(org.junit.Before)

Example 9 with AlluxioProperties

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);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioProperties(alluxio.conf.AlluxioProperties) ByteArrayInputStream(java.io.ByteArrayInputStream) AlluxioProperties(alluxio.conf.AlluxioProperties) Properties(java.util.Properties)

Example 10 with 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;
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioProperties(alluxio.conf.AlluxioProperties) ConfigProperty(alluxio.grpc.ConfigProperty) AlluxioProperties(alluxio.conf.AlluxioProperties) Properties(java.util.Properties)

Aggregations

AlluxioProperties (alluxio.conf.AlluxioProperties)11 InstancedConfiguration (alluxio.conf.InstancedConfiguration)11 Properties (java.util.Properties)4 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 HashMap (java.util.HashMap)2 AlluxioURI (alluxio.AlluxioURI)1 CommandUtils (alluxio.cli.CommandUtils)1 AbstractFsAdminCommand (alluxio.cli.fsadmin.command.AbstractFsAdminCommand)1 Context (alluxio.cli.fsadmin.command.Context)1 AlluxioBlockStore (alluxio.client.block.AlluxioBlockStore)1 FileSystemContext (alluxio.client.file.FileSystemContext)1 InStreamOptions (alluxio.client.file.options.InStreamOptions)1 PropertyKey (alluxio.conf.PropertyKey)1 PathConfiguration (alluxio.conf.path.PathConfiguration)1 InvalidArgumentException (alluxio.exception.status.InvalidArgumentException)1 ConfigProperty (alluxio.grpc.ConfigProperty)1 GetConfigurationPOptions (alluxio.grpc.GetConfigurationPOptions)1 OpenFilePOptions (alluxio.grpc.OpenFilePOptions)1 UnderFileSystemConfiguration (alluxio.underfs.UnderFileSystemConfiguration)1