use of alluxio.job.JobServerContext in project alluxio by Alluxio.
the class CompactDefinitionSelectExecutorsTest method testExecutorsParallel.
@Test
public void testExecutorsParallel() throws Exception {
int tasksPerWorker = 10;
int numCompactedFiles = 100;
int totalFiles = 5000;
PartitionInfo mockPartitionInfo = mock(PartitionInfo.class);
when(mockPartitionInfo.getFormat(any())).thenReturn(Format.CSV);
CompactConfig config = new CompactConfig(mockPartitionInfo, INPUT_DIR, mockPartitionInfo, OUTPUT_DIR, numCompactedFiles, 2 * FileUtils.ONE_GB);
List<URIStatus> inputFiles = new ArrayList<>();
for (int i = 0; i < totalFiles; i++) {
inputFiles.add(newFile(Integer.toString(i)));
}
when(mMockFileSystem.listStatus(new AlluxioURI(INPUT_DIR))).thenReturn(inputFiles);
Set<Pair<WorkerInfo, ArrayList<CompactTask>>> result = new CompactDefinition().selectExecutors(config, SelectExecutorsTest.JOB_WORKERS, new SelectExecutorsContext(1, new JobServerContext(mMockFileSystem, mMockFileSystemContext, mMockUfsManager)));
assertEquals(JOB_WORKERS.size() * tasksPerWorker, result.size());
int allCompactTasks = 0;
for (Pair<WorkerInfo, ArrayList<CompactTask>> tasks : result) {
allCompactTasks += tasks.getSecond().size();
}
assertEquals(numCompactedFiles, allCompactTasks);
}
use of alluxio.job.JobServerContext in project alluxio by Alluxio.
the class MigrateDefinitionSelectExecutorsTest method migrateNoLocalJobWorker.
@Test
public void migrateNoLocalJobWorker() throws Exception {
createFileWithBlocksOnWorkers("/src", 0);
setPathToNotExist("/dst");
Set<Pair<WorkerInfo, MigrateCommand>> assignments = new MigrateDefinition().selectExecutors(new MigrateConfig("/src", "/dst", "THROUGH", true), ImmutableList.of(JOB_WORKER_3), new SelectExecutorsContext(1, new JobServerContext(mMockFileSystem, mMockFileSystemContext, mMockUfsManager)));
Assert.assertEquals(ImmutableSet.of(new Pair<>(JOB_WORKER_3, new MigrateCommand("/src", "/dst"))), assignments);
}
use of alluxio.job.JobServerContext in project alluxio by Alluxio.
the class PersistDefinitionTest method before.
@Before
public void before() {
mMockFileSystem = Mockito.mock(FileSystem.class);
mMockFileSystemContext = PowerMockito.mock(FileSystemContext.class);
mMockBlockStore = PowerMockito.mock(AlluxioBlockStore.class);
PowerMockito.mockStatic(AlluxioBlockStore.class);
PowerMockito.when(AlluxioBlockStore.create(mMockFileSystemContext)).thenReturn(mMockBlockStore);
mJobServerContext = new JobServerContext(mMockFileSystem, mMockFileSystemContext, mock(UfsManager.class));
}
use of alluxio.job.JobServerContext in project alluxio by Alluxio.
the class EvictDefinitionTest method before.
@Before
public void before() {
mMockFileSystemContext = PowerMockito.mock(FileSystemContext.class);
mMockFileSystem = PowerMockito.mock(FileSystem.class);
mMockBlockStore = PowerMockito.mock(AlluxioBlockStore.class);
mJobServerContext = new JobServerContext(mMockFileSystem, mMockFileSystemContext, PowerMockito.mock(UfsManager.class));
}
Aggregations