Search in sources :

Example 6 with JobServerContext

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);
}
Also used : JobServerContext(alluxio.job.JobServerContext) ArrayList(java.util.ArrayList) WorkerInfo(alluxio.wire.WorkerInfo) URIStatus(alluxio.client.file.URIStatus) SelectExecutorsContext(alluxio.job.SelectExecutorsContext) AlluxioURI(alluxio.AlluxioURI) Pair(alluxio.collections.Pair) Test(org.junit.Test) SelectExecutorsTest(alluxio.job.plan.SelectExecutorsTest)

Example 7 with JobServerContext

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);
}
Also used : JobServerContext(alluxio.job.JobServerContext) SelectExecutorsContext(alluxio.job.SelectExecutorsContext) Pair(alluxio.collections.Pair) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) SelectExecutorsTest(alluxio.job.plan.SelectExecutorsTest) Test(org.junit.Test)

Example 8 with JobServerContext

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));
}
Also used : JobServerContext(alluxio.job.JobServerContext) FileSystem(alluxio.client.file.FileSystem) FileSystemContext(alluxio.client.file.FileSystemContext) AlluxioBlockStore(alluxio.client.block.AlluxioBlockStore) Before(org.junit.Before)

Example 9 with JobServerContext

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));
}
Also used : JobServerContext(alluxio.job.JobServerContext) FileSystem(alluxio.client.file.FileSystem) FileSystemContext(alluxio.client.file.FileSystemContext) AlluxioBlockStore(alluxio.client.block.AlluxioBlockStore) Before(org.junit.Before)

Aggregations

JobServerContext (alluxio.job.JobServerContext)9 FileSystem (alluxio.client.file.FileSystem)7 FileSystemContext (alluxio.client.file.FileSystemContext)7 Before (org.junit.Before)7 AlluxioBlockStore (alluxio.client.block.AlluxioBlockStore)5 AlluxioURI (alluxio.AlluxioURI)3 UfsManager (alluxio.underfs.UfsManager)3 URIStatus (alluxio.client.file.URIStatus)2 Pair (alluxio.collections.Pair)2 SelectExecutorsContext (alluxio.job.SelectExecutorsContext)2 SelectExecutorsTest (alluxio.job.plan.SelectExecutorsTest)2 WorkerInfo (alluxio.wire.WorkerInfo)2 Test (org.junit.Test)2 JobConfig (alluxio.job.JobConfig)1 PlanDefinitionRegistry (alluxio.job.plan.PlanDefinitionRegistry)1 CommandManager (alluxio.master.job.command.CommandManager)1 BlockInfo (alluxio.wire.BlockInfo)1 FileBlockInfo (alluxio.wire.FileBlockInfo)1 FileInfo (alluxio.wire.FileInfo)1 WorkerNetAddress (alluxio.wire.WorkerNetAddress)1