use of alluxio.wire.BlockLocation in project alluxio by Alluxio.
the class ReplicateDefinitionTest method selectExecutorsOneOutOFTwoWorkersValid.
@Test
public void selectExecutorsOneOutOFTwoWorkersValid() throws Exception {
mTestBlockInfo.setLocations(Lists.newArrayList(new BlockLocation().setWorkerAddress(ADDRESS_1)));
Set<Pair<WorkerInfo, SerializableVoid>> result = selectExecutorsTestHelper(1, Lists.newArrayList(WORKER_INFO_1, WORKER_INFO_2, WORKER_INFO_3));
// select one worker out of two
assertEquals(1, result.size());
assertEquals(null, result.iterator().next().getSecond());
}
use of alluxio.wire.BlockLocation in project alluxio by Alluxio.
the class ReplicateDefinitionTest method selectExecutorsTwoWorkersValid.
@Test
public void selectExecutorsTwoWorkersValid() throws Exception {
mTestBlockInfo.setLocations(Lists.newArrayList(new BlockLocation().setWorkerAddress(ADDRESS_1)));
Set<Pair<WorkerInfo, SerializableVoid>> result = selectExecutorsTestHelper(2, Lists.newArrayList(WORKER_INFO_1, WORKER_INFO_2, WORKER_INFO_3));
Set<Pair<WorkerInfo, SerializableVoid>> expected = Sets.newHashSet();
expected.add(new Pair<>(WORKER_INFO_2, null));
expected.add(new Pair<>(WORKER_INFO_3, null));
// select both workers left
assertEquals(expected, result);
}
use of alluxio.wire.BlockLocation in project alluxio by Alluxio.
the class ReplicateDefinitionTest method selectExecutorsNoWorkerValid.
@Test
public void selectExecutorsNoWorkerValid() throws Exception {
mTestBlockInfo.setLocations(Lists.newArrayList(new BlockLocation().setWorkerAddress(ADDRESS_1)));
Set<Pair<WorkerInfo, SerializableVoid>> result = selectExecutorsTestHelper(1, Lists.newArrayList(WORKER_INFO_1));
Set<Pair<WorkerInfo, SerializableVoid>> expected = ImmutableSet.of();
// select none as no choice left
assertEquals(expected, result);
}
use of alluxio.wire.BlockLocation in project alluxio by Alluxio.
the class LocationCommand method runPlainPath.
@Override
protected void runPlainPath(AlluxioURI plainPath, CommandLine cl) throws AlluxioException, IOException {
URIStatus status = mFileSystem.getStatus(plainPath);
System.out.println(plainPath + " with file id " + status.getFileId() + " is on nodes: ");
AlluxioBlockStore blockStore = AlluxioBlockStore.create(mFsContext);
for (long blockId : status.getBlockIds()) {
for (BlockLocation location : blockStore.getInfo(blockId).getLocations()) {
System.out.println(location.getWorkerAddress().getHost());
}
}
}
use of alluxio.wire.BlockLocation in project alluxio by Alluxio.
the class DefaultAsyncPersistHandlerTest method persistenceFileWithBlocksOnMultipleWorkers.
/**
* Tests the persistence of file with block on multiple workers.
*/
@Test
public void persistenceFileWithBlocksOnMultipleWorkers() throws Exception {
DefaultAsyncPersistHandler handler = new DefaultAsyncPersistHandler(new FileSystemMasterView(mFileSystemMaster));
AlluxioURI path = new AlluxioURI("/test");
List<FileBlockInfo> blockInfoList = new ArrayList<>();
BlockLocation location1 = new BlockLocation().setWorkerId(1);
blockInfoList.add(new FileBlockInfo().setBlockInfo(new BlockInfo().setLocations(Lists.newArrayList(location1))));
BlockLocation location2 = new BlockLocation().setWorkerId(2);
blockInfoList.add(new FileBlockInfo().setBlockInfo(new BlockInfo().setLocations(Lists.newArrayList(location2))));
long fileId = 2;
when(mFileSystemMaster.getFileId(path)).thenReturn(fileId);
when(mFileSystemMaster.getFileInfo(fileId)).thenReturn(new FileInfo().setLength(1).setCompleted(true));
when(mFileSystemMaster.getFileBlockInfoList(path)).thenReturn(blockInfoList);
// no persist scheduled on any worker
assertEquals(0, handler.pollFilesToPersist(1).size());
assertEquals(0, handler.pollFilesToPersist(2).size());
}
Aggregations