@Override public boolean deleteLineage(long lineageId, DeleteLineageOptions options) throws IOException, LineageDoesNotExistException, LineageDeletionException, AlluxioException { LineageMasterClient masterClient = mContext.acquireMasterClient(); try { boolean result = masterClient.deleteLineage(lineageId, options.isCascade()); LOG.info("{} delete lineage {}", result ? "Succeeded to " : "Failed to ", lineageId); return result; } finally { mContext.releaseMasterClient(masterClient); } }
@Override public List<LineageInfo> getLineageInfoList(GetLineageInfoListOptions options) throws IOException { LineageMasterClient masterClient = mContext.acquireMasterClient(); try { return masterClient.getLineageInfoList(); } catch (ConnectionFailedException e) { throw new IOException(e); } finally { mContext.releaseMasterClient(masterClient); } }
/** Tests that a {@link DummyFileOutputStream} is returned. */ @Test public void getDummyOutStreamTest() throws Exception { AlluxioURI path = new AlluxioURI("test"); Mockito.when(mLineageMasterClient.reinitializeFile("test", TEST_BLOCK_SIZE, 0)).thenReturn(-1L); CreateFileOptions options = CreateFileOptions.defaults().setBlockSizeBytes(TEST_BLOCK_SIZE).setTtl(0); FileOutStream outStream = mAlluxioLineageFileSystem.createFile(path, options); Assert.assertTrue(outStream instanceof DummyFileOutputStream); // verify client is released Mockito.verify(mLineageContext).releaseMasterClient(mLineageMasterClient); }
@Override public long createLineage( List<AlluxioURI> inputFiles, List<AlluxioURI> outputFiles, Job job, CreateLineageOptions options) throws FileDoesNotExistException, AlluxioException, IOException { // TODO(yupeng): relax this to support other type of jobs Preconditions.checkState( job instanceof CommandLineJob, PreconditionMessage.COMMAND_LINE_LINEAGE_ONLY); LineageMasterClient masterClient = mContext.acquireMasterClient(); try { long lineageId = masterClient.createLineage( stripURIList(inputFiles), stripURIList(outputFiles), (CommandLineJob) job); LOG.info("Created lineage {}", lineageId); return lineageId; } finally { mContext.releaseMasterClient(masterClient); } }