Search in sources :

Example 1 with LineageFileSystem

use of alluxio.client.lineage.LineageFileSystem in project alluxio by Alluxio.

the class LineageMasterIntegrationTest method lineageCompleteAndAsyncPersist.

@Test
public void lineageCompleteAndAsyncPersist() throws Exception {
    try (LineageMasterClient lineageMasterClient = getLineageMasterClient()) {
        ArrayList<String> outFiles = new ArrayList<>();
        Collections.addAll(outFiles, OUT_FILE);
        lineageMasterClient.createLineage(new ArrayList<String>(), outFiles, mJob);
        CreateFileOptions options = CreateFileOptions.defaults().setWriteType(WriteType.MUST_CACHE).setBlockSizeBytes(BLOCK_SIZE_BYTES);
        LineageFileSystem fs = (LineageFileSystem) mLocalAlluxioClusterResource.get().getClient();
        FileOutStream outputStream = fs.createFile(new AlluxioURI(OUT_FILE), options);
        outputStream.write(1);
        outputStream.close();
        List<LineageInfo> infos = lineageMasterClient.getLineageInfoList();
        AlluxioURI uri = new AlluxioURI(infos.get(0).getOutputFiles().get(0));
        URIStatus status = getFileSystemMasterClient().getStatus(uri);
        Assert.assertNotEquals(PersistenceState.PERSISTED.toString(), status.getPersistenceState());
        Assert.assertTrue(status.isCompleted());
        IntegrationTestUtils.waitForPersist(mLocalAlluxioClusterResource, uri);
        // worker notifies the master
        status = getFileSystemMasterClient().getStatus(uri);
        Assert.assertEquals(PersistenceState.PERSISTED.toString(), status.getPersistenceState());
    }
}
Also used : CreateFileOptions(alluxio.client.file.options.CreateFileOptions) ArrayList(java.util.ArrayList) FileOutStream(alluxio.client.file.FileOutStream) LineageMasterClient(alluxio.client.lineage.LineageMasterClient) LineageFileSystem(alluxio.client.lineage.LineageFileSystem) URIStatus(alluxio.client.file.URIStatus) LineageInfo(alluxio.wire.LineageInfo) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Aggregations

AlluxioURI (alluxio.AlluxioURI)1 FileOutStream (alluxio.client.file.FileOutStream)1 URIStatus (alluxio.client.file.URIStatus)1 CreateFileOptions (alluxio.client.file.options.CreateFileOptions)1 LineageFileSystem (alluxio.client.lineage.LineageFileSystem)1 LineageMasterClient (alluxio.client.lineage.LineageMasterClient)1 LineageInfo (alluxio.wire.LineageInfo)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1