use of alluxio.job.CommandLineJob in project alluxio by Alluxio.
the class Lineage method toJournalEntry.
@Override
public synchronized JournalEntry toJournalEntry() {
List<Long> inputFileIds = new ArrayList<>(mInputFiles);
List<Long> outputFileIds = new ArrayList<>(mOutputFiles);
Preconditions.checkState(mJob instanceof CommandLineJob);
CommandLineJob commandLineJob = (CommandLineJob) mJob;
String jobCommand = commandLineJob.getCommand();
String jobOutputPath = commandLineJob.getJobConf().getOutputFilePath();
LineageEntry lineage = LineageEntry.newBuilder().setId(mId).addAllInputFiles(inputFileIds).addAllOutputFileIds(outputFileIds).setJobCommand(jobCommand).setJobOutputPath(jobOutputPath).setCreationTimeMs(mCreationTimeMs).build();
return JournalEntry.newBuilder().setLineage(lineage).build();
}
use of alluxio.job.CommandLineJob in project alluxio by Alluxio.
the class LineageMasterClientRestApiTest method deleteLineage.
@Test
@Config(confParams = { PropertyKey.Name.USER_LINEAGE_ENABLED, "true" })
public void deleteLineage() throws Exception {
LineageMaster lineageMaster = mMaster.getLineageMaster();
long lineageId = lineageMaster.createLineage(new ArrayList<AlluxioURI>(), new ArrayList<AlluxioURI>(), new CommandLineJob("test", new JobConf("/output")));
Map<String, String> params = new HashMap<>();
params.put("lineageId", Long.toString(lineageId));
params.put("cascade", "false");
new TestCase(mHostname, mPort, getEndpoint(LineageMasterClientRestServiceHandler.DELETE_LINEAGE), params, HttpMethod.POST, true).run();
}
use of alluxio.job.CommandLineJob in project alluxio by Alluxio.
the class LineageMasterIntegrationTest method docExample.
/**
* Runs code given in the docs (http://alluxio.org/documentation/Lineage-API.html) to make sure it
* actually runs.
*
* If you need to update the doc-code here, make sure you also update it in the docs.
*/
@Test
public void docExample() throws Exception {
// create input files
FileSystem fs = FileSystem.Factory.get();
fs.createFile(new AlluxioURI("/inputFile1")).close();
fs.createFile(new AlluxioURI("/inputFile2")).close();
// ------ code block from docs ------
AlluxioLineage tl = AlluxioLineage.get();
// input file paths
AlluxioURI input1 = new AlluxioURI("/inputFile1");
AlluxioURI input2 = new AlluxioURI("/inputFile2");
ArrayList<AlluxioURI> inputFiles = new ArrayList<>();
Collections.addAll(inputFiles, input1, input2);
// output file paths
AlluxioURI output = new AlluxioURI("/outputFile");
ArrayList<AlluxioURI> outputFiles = new ArrayList<>();
Collections.addAll(outputFiles, output);
// command-line job
JobConf conf = new JobConf("/tmp/recompute.log");
CommandLineJob job = new CommandLineJob("my-spark-job.sh", conf);
long lineageId = tl.createLineage(inputFiles, outputFiles, job);
// ------ code block from docs ------
DeleteLineageOptions options = DeleteLineageOptions.defaults().setCascade(true);
tl.deleteLineage(lineageId);
fs.delete(new AlluxioURI("/outputFile"));
lineageId = tl.createLineage(inputFiles, outputFiles, job);
// ------ code block from docs ------
tl.deleteLineage(lineageId, options);
}
use of alluxio.job.CommandLineJob in project alluxio by Alluxio.
the class CheckpointLatestPlannerTest method before.
/**
* Sets up all dependencies before a test runs.
*/
@Before
public void before() {
mLineageStore = new LineageStore(new LineageIdGenerator());
mJob = new CommandLineJob("test", new JobConf("output"));
mFileSystemMaster = Mockito.mock(FileSystemMaster.class);
mPlanner = new CheckpointLatestPlanner(new LineageStoreView(mLineageStore), new FileSystemMasterView(mFileSystemMaster));
}
use of alluxio.job.CommandLineJob in project alluxio by Alluxio.
the class RecomputePlannerTest method before.
/**
* Sets up the dependencies before a test runs.
*/
@Before
public void before() {
mLineageStore = new LineageStore(new LineageIdGenerator());
mJob = new CommandLineJob("test", new JobConf("output"));
mFileSystemMaster = Mockito.mock(FileSystemMaster.class);
Mockito.when(mFileSystemMaster.getFileSystemMasterView()).thenReturn(new FileSystemMasterView(mFileSystemMaster));
mPlanner = new RecomputePlanner(mLineageStore, mFileSystemMaster);
}
Aggregations