use of alluxio.job.Job in project alluxio by Alluxio.
the class TestRecomputeExecutor method recomputeLauncher.
/**
* Tests recompute executor creates a recompute plan and launches the recompute job at heartbeat.
*
* @throws Exception if anything wrong happens
*/
@Test
public void recomputeLauncher() throws Exception {
long fileId = 5L;
// mock planner
RecomputePlanner planner = Mockito.mock(RecomputePlanner.class);
Job job = Mockito.mock(Job.class);
Lineage lineage = new Lineage(1, new ArrayList<Long>(), Lists.newArrayList(fileId), job);
Mockito.when(planner.plan()).thenReturn(new RecomputePlan(Lists.newArrayList(lineage)));
// mock file system master
FileSystemMaster fileSystemMaster = Mockito.mock(FileSystemMaster.class);
Mockito.when(fileSystemMaster.getFileSystemMasterView()).thenReturn(new FileSystemMasterView(fileSystemMaster));
Mockito.when(fileSystemMaster.getLostFiles()).thenReturn(Lists.newArrayList(fileId));
RecomputeExecutor executor = new RecomputeExecutor(planner, fileSystemMaster);
// wait for the executor to finish running
executor.heartbeatWithFuture().get(5, TimeUnit.SECONDS);
executor.close();
Mockito.verify(fileSystemMaster).resetFile(fileId);
Mockito.verify(job).run();
}
use of alluxio.job.Job in project alluxio by Alluxio.
the class Lineage method fromJournalEntry.
/**
* Converts the entry to a {@link Lineage}.
*
* @param entry the entry to convert
* @return the {@link Lineage} representation
*/
public static Lineage fromJournalEntry(LineageEntry entry) {
List<Long> inputFiles = new ArrayList<>(entry.getInputFilesList());
List<Long> outputFiles = new ArrayList<>(entry.getOutputFileIdsList());
Job job = new CommandLineJob(entry.getJobCommand(), new JobConf(entry.getJobOutputPath()));
return new Lineage(entry.getId(), inputFiles, outputFiles, job, entry.getCreationTimeMs());
}
Aggregations