Search in sources :

Example 36 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class ConfigurationUtilsTest method getMasterRpcAddresses.

@Test
public void getMasterRpcAddresses() {
    AlluxioConfiguration conf = createConf(ImmutableMap.of(PropertyKey.MASTER_RPC_ADDRESSES, "host1:99,host2:100"));
    assertEquals(Arrays.asList(InetSocketAddress.createUnresolved("host1", 99), InetSocketAddress.createUnresolved("host2", 100)), ConfigurationUtils.getMasterRpcAddresses(conf));
}
Also used : AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) Test(org.junit.Test)

Example 37 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class ConfigurationUtilsTest method getSingleJobMasterRpcAddress.

@Test
public void getSingleJobMasterRpcAddress() {
    AlluxioConfiguration conf = createConf(ImmutableMap.of(PropertyKey.JOB_MASTER_HOSTNAME, "testhost", PropertyKey.JOB_MASTER_RPC_PORT, "1000"));
    assertEquals(Arrays.asList(InetSocketAddress.createUnresolved("testhost", 1000)), ConfigurationUtils.getJobMasterRpcAddresses(conf));
}
Also used : AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) Test(org.junit.Test)

Example 38 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class ConfigurationUtilsTest method getJobMasterRpcAddressesServerFallback.

@Test
public void getJobMasterRpcAddressesServerFallback() {
    AlluxioConfiguration conf = createConf(ImmutableMap.of(PropertyKey.JOB_MASTER_EMBEDDED_JOURNAL_ADDRESSES, "host1:99,host2:100", PropertyKey.JOB_MASTER_RPC_PORT, "50"));
    assertEquals(Arrays.asList(InetSocketAddress.createUnresolved("host1", 50), InetSocketAddress.createUnresolved("host2", 50)), ConfigurationUtils.getJobMasterRpcAddresses(conf));
}
Also used : AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) Test(org.junit.Test)

Example 39 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class BlockInStream method createProcessLocalBlockInStream.

/**
 * Creates a {@link BlockInStream} to read from the worker process-local to this client
 * directly without RPC involves, if the block does not exist in this worker, will read from
 * the UFS storage via this worker.
 *
 * @param context the file system context
 * @param address the network address of the gRPC data server to read from
 * @param blockId the block ID
 * @param length the block length
 * @param options the in stream options
 * @return the {@link BlockInStream} created
 */
private static BlockInStream createProcessLocalBlockInStream(FileSystemContext context, WorkerNetAddress address, long blockId, long length, InStreamOptions options) {
    AlluxioConfiguration conf = context.getClusterConf();
    long chunkSize = conf.getBytes(PropertyKey.USER_LOCAL_READER_CHUNK_SIZE_BYTES);
    return new BlockInStream(new BlockWorkerDataReader.Factory(context.getProcessLocalWorker(), blockId, chunkSize, options), conf, address, BlockInStreamSource.PROCESS_LOCAL, blockId, length);
}
Also used : AlluxioConfiguration(alluxio.conf.AlluxioConfiguration)

Example 40 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class BlockWorkerDataWriter method create.

/**
 * Creates an instance of {@link BlockWorkerDataWriter}.
 *
 * @param context the file system context
 * @param blockId the block ID
 * @param blockSize the block size in bytes
 * @param options the output stream options
 * @return the {@link BlockWorkerDataWriter} created
 */
public static BlockWorkerDataWriter create(final FileSystemContext context, long blockId, long blockSize, OutStreamOptions options) throws IOException {
    AlluxioConfiguration conf = context.getClusterConf();
    int chunkSize = (int) conf.getBytes(PropertyKey.USER_LOCAL_WRITER_CHUNK_SIZE_BYTES);
    long reservedBytes = Math.min(blockSize, conf.getBytes(PropertyKey.USER_FILE_RESERVED_BYTES));
    BlockWorker blockWorker = context.getProcessLocalWorker();
    Preconditions.checkNotNull(blockWorker, "blockWorker");
    long sessionId = SessionIdUtils.createSessionId();
    try {
        blockWorker.createBlock(sessionId, blockId, options.getWriteTier(), options.getMediumType(), reservedBytes);
        BlockWriter blockWriter = blockWorker.createBlockWriter(sessionId, blockId);
        return new BlockWorkerDataWriter(sessionId, blockId, options, blockWriter, blockWorker, chunkSize, reservedBytes, conf);
    } catch (BlockAlreadyExistsException | WorkerOutOfSpaceException | BlockDoesNotExistException | InvalidWorkerStateException e) {
        throw new IOException(e);
    }
}
Also used : BlockAlreadyExistsException(alluxio.exception.BlockAlreadyExistsException) BlockWriter(alluxio.worker.block.io.BlockWriter) IOException(java.io.IOException) WorkerOutOfSpaceException(alluxio.exception.WorkerOutOfSpaceException) BlockDoesNotExistException(alluxio.exception.BlockDoesNotExistException) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) BlockWorker(alluxio.worker.block.BlockWorker) InvalidWorkerStateException(alluxio.exception.InvalidWorkerStateException)

Aggregations

AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)62 Test (org.junit.Test)20 InstancedConfiguration (alluxio.conf.InstancedConfiguration)17 IOException (java.io.IOException)11 AlluxioURI (alluxio.AlluxioURI)7 UnderFileSystemFactory (alluxio.underfs.UnderFileSystemFactory)7 ArrayList (java.util.ArrayList)7 AlluxioProperties (alluxio.conf.AlluxioProperties)5 PropertyKey (alluxio.conf.PropertyKey)5 OpenFilePOptions (alluxio.grpc.OpenFilePOptions)5 HealthCheckClient (alluxio.HealthCheckClient)4 FileSystemContext (alluxio.client.file.FileSystemContext)4 InStreamOptions (alluxio.client.file.options.InStreamOptions)4 InetSocketAddress (java.net.InetSocketAddress)4 Constants (alluxio.Constants)3 AlluxioBlockStore (alluxio.client.block.AlluxioBlockStore)3 FileSystem (alluxio.client.file.FileSystem)3 URIStatus (alluxio.client.file.URIStatus)3 ReadRequest (alluxio.grpc.ReadRequest)3 InputStream (java.io.InputStream)3