Search in sources :

Example 1 with CAPACITY

use of alluxio.stress.cli.RpcBenchPreparationUtils.CAPACITY in project alluxio by Alluxio.

the class RegisterWorkerBench method prepare.

@Override
public void prepare() throws Exception {
    // The task ID is different for local and cluster executions
    // So including that in the log can help associate the log to the run
    LOG.info("Task ID is {}", mBaseParameters.mId);
    mTierAliases = getTierAliases(mParameters.mTiers);
    mCapacityMap = Maps.toMap(mTierAliases, (tier) -> CAPACITY);
    mUsedMap = Maps.toMap(mTierAliases, (tier) -> 0L);
    // Generate block IDs heuristically
    Map<BlockStoreLocation, List<Long>> blockMap = RpcBenchPreparationUtils.generateBlockIdOnTiers(mParameters.mTiers);
    BlockMasterClient client = new BlockMasterClient(MasterClientContext.newBuilder(ClientContext.create(mConf)).build());
    mLocationBlockIdList = client.convertBlockListMapToProto(blockMap);
    // done once, so skip preparation when running in job worker
    if (!mBaseParameters.mDistributed) {
        // Prepare these block IDs concurrently
        LOG.info("Preparing blocks at the master");
        RpcBenchPreparationUtils.prepareBlocksInMaster(blockMap);
        LOG.info("Created all blocks at the master");
    }
    // Prepare worker IDs
    int numWorkers = mParameters.mConcurrency;
    mWorkerPool = RpcBenchPreparationUtils.prepareWorkerIds(client, numWorkers);
    Preconditions.checkState(mWorkerPool.size() == numWorkers, "Expecting %s workers but registered %s", numWorkers, mWorkerPool.size());
    LOG.info("Prepared worker IDs: {}", mWorkerPool);
}
Also used : RpcTaskResult(alluxio.stress.rpc.RpcTaskResult) BlockStoreLocation(alluxio.worker.block.BlockStoreLocation) EMPTY_CONFIG(alluxio.stress.cli.RpcBenchPreparationUtils.EMPTY_CONFIG) BlockMasterClient(alluxio.worker.block.BlockMasterClient) LoggerFactory(org.slf4j.LoggerFactory) CachingBlockMasterClient(alluxio.stress.CachingBlockMasterClient) BlockMasterBenchParameters(alluxio.stress.rpc.BlockMasterBenchParameters) Deque(java.util.Deque) PropertyKey(alluxio.conf.PropertyKey) BlockMasterSync(alluxio.worker.block.BlockMasterSync) ParametersDelegate(com.beust.jcommander.ParametersDelegate) ImmutableList(com.google.common.collect.ImmutableList) Duration(java.time.Duration) Map(java.util.Map) CAPACITY(alluxio.stress.cli.RpcBenchPreparationUtils.CAPACITY) LocationBlockIdListEntry(alluxio.grpc.LocationBlockIdListEntry) ClientContext(alluxio.ClientContext) TierAlias(alluxio.stress.rpc.TierAlias) Logger(org.slf4j.Logger) LOST_STORAGE(alluxio.stress.cli.RpcBenchPreparationUtils.LOST_STORAGE) ImmutableMap(com.google.common.collect.ImmutableMap) Instant(java.time.Instant) Maps(com.google.common.collect.Maps) Collectors(java.util.stream.Collectors) List(java.util.List) MasterClientContext(alluxio.master.MasterClientContext) Preconditions(com.google.common.base.Preconditions) ArrayDeque(java.util.ArrayDeque) InstancedConfiguration(alluxio.conf.InstancedConfiguration) BlockMasterClient(alluxio.worker.block.BlockMasterClient) CachingBlockMasterClient(alluxio.stress.CachingBlockMasterClient) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) BlockStoreLocation(alluxio.worker.block.BlockStoreLocation)

Example 2 with CAPACITY

use of alluxio.stress.cli.RpcBenchPreparationUtils.CAPACITY in project alluxio by Alluxio.

the class StreamRegisterWorkerBench method prepare.

@Override
public void prepare() throws Exception {
    // The task ID is different for local and cluster executions
    // So including that in the log can help associate the log to the run
    LOG.info("Task ID is {}", mBaseParameters.mId);
    mTierAliases = getTierAliases(mParameters.mTiers);
    mCapacityMap = Maps.toMap(mTierAliases, (tier) -> CAPACITY);
    mUsedMap = Maps.toMap(mTierAliases, (tier) -> 0L);
    // Generate block IDs heuristically
    Map<BlockStoreLocation, List<Long>> blockMap = RpcBenchPreparationUtils.generateBlockIdOnTiers(mParameters.mTiers);
    BlockMasterClient client = new BlockMasterClient(MasterClientContext.newBuilder(ClientContext.create(mConf)).build());
    mBlockMap = blockMap;
    // done once, so skip preparation when running in job worker
    if (!mBaseParameters.mDistributed) {
        // Prepare these block IDs concurrently
        LOG.info("Preparing blocks at the master");
        RpcBenchPreparationUtils.prepareBlocksInMaster(blockMap);
        LOG.info("Created all blocks at the master");
    }
    // Prepare worker IDs
    int numWorkers = mParameters.mConcurrency;
    mWorkerPool = RpcBenchPreparationUtils.prepareWorkerIds(client, numWorkers);
    Preconditions.checkState(mWorkerPool.size() == numWorkers, "Expecting %s workers but registered %s", numWorkers, mWorkerPool.size());
    LOG.info("Prepared worker IDs: {}", mWorkerPool);
}
Also used : RpcTaskResult(alluxio.stress.rpc.RpcTaskResult) BlockStoreLocation(alluxio.worker.block.BlockStoreLocation) EMPTY_CONFIG(alluxio.stress.cli.RpcBenchPreparationUtils.EMPTY_CONFIG) BlockMasterClient(alluxio.worker.block.BlockMasterClient) LoggerFactory(org.slf4j.LoggerFactory) CachingBlockMasterClient(alluxio.stress.CachingBlockMasterClient) BlockMasterBenchParameters(alluxio.stress.rpc.BlockMasterBenchParameters) Deque(java.util.Deque) PropertyKey(alluxio.conf.PropertyKey) BlockMasterSync(alluxio.worker.block.BlockMasterSync) ParametersDelegate(com.beust.jcommander.ParametersDelegate) ImmutableList(com.google.common.collect.ImmutableList) Duration(java.time.Duration) Map(java.util.Map) CAPACITY(alluxio.stress.cli.RpcBenchPreparationUtils.CAPACITY) LocationBlockIdListEntry(alluxio.grpc.LocationBlockIdListEntry) ClientContext(alluxio.ClientContext) TierAlias(alluxio.stress.rpc.TierAlias) Logger(org.slf4j.Logger) LOST_STORAGE(alluxio.stress.cli.RpcBenchPreparationUtils.LOST_STORAGE) Instant(java.time.Instant) Maps(com.google.common.collect.Maps) Collectors(java.util.stream.Collectors) List(java.util.List) MasterClientContext(alluxio.master.MasterClientContext) Preconditions(com.google.common.base.Preconditions) ArrayDeque(java.util.ArrayDeque) InstancedConfiguration(alluxio.conf.InstancedConfiguration) BlockMasterClient(alluxio.worker.block.BlockMasterClient) CachingBlockMasterClient(alluxio.stress.CachingBlockMasterClient) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) BlockStoreLocation(alluxio.worker.block.BlockStoreLocation)

Aggregations

ClientContext (alluxio.ClientContext)2 InstancedConfiguration (alluxio.conf.InstancedConfiguration)2 PropertyKey (alluxio.conf.PropertyKey)2 LocationBlockIdListEntry (alluxio.grpc.LocationBlockIdListEntry)2 MasterClientContext (alluxio.master.MasterClientContext)2 CachingBlockMasterClient (alluxio.stress.CachingBlockMasterClient)2 CAPACITY (alluxio.stress.cli.RpcBenchPreparationUtils.CAPACITY)2 EMPTY_CONFIG (alluxio.stress.cli.RpcBenchPreparationUtils.EMPTY_CONFIG)2 LOST_STORAGE (alluxio.stress.cli.RpcBenchPreparationUtils.LOST_STORAGE)2 BlockMasterBenchParameters (alluxio.stress.rpc.BlockMasterBenchParameters)2 RpcTaskResult (alluxio.stress.rpc.RpcTaskResult)2 TierAlias (alluxio.stress.rpc.TierAlias)2 BlockMasterClient (alluxio.worker.block.BlockMasterClient)2 BlockMasterSync (alluxio.worker.block.BlockMasterSync)2 BlockStoreLocation (alluxio.worker.block.BlockStoreLocation)2 ParametersDelegate (com.beust.jcommander.ParametersDelegate)2 Preconditions (com.google.common.base.Preconditions)2 ImmutableList (com.google.common.collect.ImmutableList)2 Maps (com.google.common.collect.Maps)2 Duration (java.time.Duration)2