コード例 #1
0
 @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);
   }
 }
コード例 #2
0
  @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);
    }
  }
コード例 #3
0
 @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);
   }
 }
コード例 #4
0
 /** Sets up all dependencies before running a test. */
 @Before
 public void before() {
   mLineageMasterClient = PowerMockito.mock(LineageMasterClient.class);
   mLineageContext = PowerMockito.mock(LineageContext.class);
   Mockito.when(mLineageContext.acquireMasterClient()).thenReturn(mLineageMasterClient);
   Whitebox.setInternalState(LineageContext.class, "INSTANCE", mLineageContext);
   mAlluxioLineageFileSystem = LineageFileSystem.get();
   Whitebox.setInternalState(mAlluxioLineageFileSystem, "mLineageContext", mLineageContext);
   FileSystemContext fileSystemContext = PowerMockito.mock(FileSystemContext.class);
   FileSystemMasterClient fileSystemMasterClient = PowerMockito.mock(FileSystemMasterClient.class);
   Mockito.when(fileSystemContext.acquireMasterClient()).thenReturn(fileSystemMasterClient);
   Whitebox.setInternalState(FileSystemContext.class, "INSTANCE", fileSystemContext);
   Whitebox.setInternalState(mAlluxioLineageFileSystem, "mContext", fileSystemContext);
 }