arjun4084346 commented on code in PR #3568:
URL: https://github.com/apache/gobblin/pull/3568#discussion_r978913179


##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/RecursiveCopyableDataset.java:
##########
@@ -195,22 +196,28 @@ public Collection<? extends CopyEntity> 
getCopyableFiles(FileSystem targetFs, Co
 
     Map<Path, FileStatus> filesInSource =
         createPathMap(getFilesAtPath(this.fs, this.rootPath, this.pathFilter), 
this.rootPath);
-    Map<Path, FileStatus> filesInTarget =
-        createPathMap(getFilesAtPath(targetFs, targetPath, this.pathFilter), 
targetPath);
+
+    // Allow fileNotFoundException for filesInTarget since if it doesn't 
exist, they will be created.
+    List<FileStatus> filesAtPath = Lists.newArrayList();
+    try {
+      filesAtPath = getFilesAtPath(targetFs, targetPath, this.pathFilter);
+    } catch (FileNotFoundException e) {
+      log.info(String.format("Could not find any files on targetFs %s path 
%s.", targetFs.getUri(), targetPath));
+    }
+    Map<Path, FileStatus> filesInTarget = createPathMap(filesAtPath, 
targetPath);
 
     return getCopyableFilesImpl(configuration, filesInSource, filesInTarget, 
targetFs,
             nonGlobSearchPath, configuration.getPublishDir(), targetPath);
   }
 
   @VisibleForTesting
   protected List<FileStatus> getFilesAtPath(FileSystem fs, Path path, 
PathFilter fileFilter)
-      throws IOException {
+      throws FileNotFoundException {
     try {
       return FileListUtils
           .listFilesToCopyAtPath(fs, path, fileFilter, 
applyFilterToDirectories, includeEmptyDirectories);
     } catch (IOException e) {
-      log.warn(String.format("Could not find any files on fs %s path %s due to 
the following exception. Returning an empty list of files.", fs.getUri(), 
path), e);
-      return Lists.newArrayList();
+      throw new FileNotFoundException(String.format("Could not find any files 
on fs %s path %s.", fs.getUri(), path));
     }

Review Comment:
   Yes, lets handle no workunits creation case separately.
   I think we just want to reverse 
https://github.com/apache/gobblin/pull/3263/files



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to