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));
}
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));
}
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));
}
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);
}
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);
}
}
Aggregations