Search in sources :

Example 1 with JobConf

use of alluxio.job.JobConf 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();
}
Also used : HashMap(java.util.HashMap) TestCase(alluxio.rest.TestCase) CommandLineJob(alluxio.job.CommandLineJob) JobConf(alluxio.job.JobConf) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest) Config(alluxio.LocalAlluxioClusterResource.Config)

Example 2 with JobConf

use of alluxio.job.JobConf 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 JobConf

use of alluxio.job.JobConf 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));
}
Also used : FileSystemMasterView(alluxio.master.file.meta.FileSystemMasterView) LineageStore(alluxio.master.lineage.meta.LineageStore) FileSystemMaster(alluxio.master.file.FileSystemMaster) LineageIdGenerator(alluxio.master.lineage.meta.LineageIdGenerator) CommandLineJob(alluxio.job.CommandLineJob) JobConf(alluxio.job.JobConf) LineageStoreView(alluxio.master.lineage.meta.LineageStoreView) Before(org.junit.Before)

Example 4 with JobConf

use of alluxio.job.JobConf 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);
}
Also used : FileSystemMasterView(alluxio.master.file.meta.FileSystemMasterView) LineageStore(alluxio.master.lineage.meta.LineageStore) FileSystemMaster(alluxio.master.file.FileSystemMaster) LineageIdGenerator(alluxio.master.lineage.meta.LineageIdGenerator) CommandLineJob(alluxio.job.CommandLineJob) JobConf(alluxio.job.JobConf) Before(org.junit.Before)

Example 5 with JobConf

use of alluxio.job.JobConf in project alluxio by Alluxio.

the class CreateLineageCommand method run.

@Override
public void run(CommandLine cl) throws AlluxioException, IOException {
    String[] args = cl.getArgs();
    AlluxioLineage tl = AlluxioLineage.get(LineageContext.INSTANCE);
    // TODO(yupeng) more validation
    List<AlluxioURI> inputFiles = new ArrayList<>();
    if (!args[0].equals("noInput")) {
        for (String path : args[0].split(",")) {
            inputFiles.add(new AlluxioURI(path));
        }
    }
    List<AlluxioURI> outputFiles = new ArrayList<>();
    for (String path : args[1].split(",")) {
        outputFiles.add(new AlluxioURI(path));
    }
    String cmd = "";
    for (int i = 2; i < args.length; i++) {
        cmd += args[i] + " ";
    }
    String outputPath = Configuration.get(PropertyKey.MASTER_LINEAGE_RECOMPUTE_LOG_PATH);
    if (outputPath == null) {
        throw new IOException("recompute output log is not configured");
    }
    CommandLineJob job = new CommandLineJob(cmd, new JobConf(outputPath));
    long lineageId = tl.createLineage(inputFiles, outputFiles, job);
    System.out.println("Lineage " + lineageId + " has been created.");
}
Also used : AlluxioLineage(alluxio.client.lineage.AlluxioLineage) ArrayList(java.util.ArrayList) IOException(java.io.IOException) CommandLineJob(alluxio.job.CommandLineJob) JobConf(alluxio.job.JobConf) AlluxioURI(alluxio.AlluxioURI)

Aggregations

CommandLineJob (alluxio.job.CommandLineJob)12 JobConf (alluxio.job.JobConf)12 AlluxioURI (alluxio.AlluxioURI)6 Before (org.junit.Before)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 FileSystemMaster (alluxio.master.file.FileSystemMaster)3 Config (alluxio.LocalAlluxioClusterResource.Config)2 FileSystem (alluxio.client.file.FileSystem)2 AlluxioLineage (alluxio.client.lineage.AlluxioLineage)2 LineageFileSystem (alluxio.client.lineage.LineageFileSystem)2 FileSystemMasterView (alluxio.master.file.meta.FileSystemMasterView)2 LineageIdGenerator (alluxio.master.lineage.meta.LineageIdGenerator)2 LineageStore (alluxio.master.lineage.meta.LineageStore)2 RestApiTest (alluxio.rest.RestApiTest)2 TestCase (alluxio.rest.TestCase)2 FileOutStream (alluxio.client.file.FileOutStream)1 LineageMasterClient (alluxio.client.lineage.LineageMasterClient)1 DeleteLineageOptions (alluxio.client.lineage.options.DeleteLineageOptions)1 Job (alluxio.job.Job)1