Search in sources :

Example 1 with DeleteLineageOptions

use of alluxio.client.lineage.options.DeleteLineageOptions in project alluxio by Alluxio.

the class DeleteLineageCommand method run.

@Override
public void run(CommandLine cl) throws AlluxioException, IOException {
    String[] args = cl.getArgs();
    AlluxioLineage tl = AlluxioLineage.get(LineageContext.INSTANCE);
    long lineageId = Long.parseLong(args[0]);
    boolean cascade = Boolean.parseBoolean(args[1]);
    DeleteLineageOptions options = DeleteLineageOptions.defaults().setCascade(cascade);
    tl.deleteLineage(lineageId, options);
    System.out.println("Lineage " + lineageId + " has been deleted.");
}
Also used : AlluxioLineage(alluxio.client.lineage.AlluxioLineage) DeleteLineageOptions(alluxio.client.lineage.options.DeleteLineageOptions)

Example 2 with DeleteLineageOptions

use of alluxio.client.lineage.options.DeleteLineageOptions 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);
}
Also used : AlluxioLineage(alluxio.client.lineage.AlluxioLineage) FileSystem(alluxio.client.file.FileSystem) LineageFileSystem(alluxio.client.lineage.LineageFileSystem) ArrayList(java.util.ArrayList) DeleteLineageOptions(alluxio.client.lineage.options.DeleteLineageOptions) JobConf(alluxio.job.JobConf) CommandLineJob(alluxio.job.CommandLineJob) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 3 with DeleteLineageOptions

use of alluxio.client.lineage.options.DeleteLineageOptions in project alluxio by Alluxio.

the class AlluxioLineageTest method deleteLineage.

@Test
public void deleteLineage() throws Exception {
    DeleteLineageOptions options = DeleteLineageOptions.defaults().setCascade(true);
    mAlluxioLineage.deleteLineage(0, options);
    Mockito.verify(mLineageMasterClient).deleteLineage(0, true);
    // verify client is released
    Mockito.verify(mLineageContext).releaseMasterClient(mLineageMasterClient);
}
Also used : DeleteLineageOptions(alluxio.client.lineage.options.DeleteLineageOptions) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

DeleteLineageOptions (alluxio.client.lineage.options.DeleteLineageOptions)3 AlluxioLineage (alluxio.client.lineage.AlluxioLineage)2 Test (org.junit.Test)2 AlluxioURI (alluxio.AlluxioURI)1 FileSystem (alluxio.client.file.FileSystem)1 LineageFileSystem (alluxio.client.lineage.LineageFileSystem)1 CommandLineJob (alluxio.job.CommandLineJob)1 JobConf (alluxio.job.JobConf)1 ArrayList (java.util.ArrayList)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1