Skip to content

Commit

Permalink
Merge pull request #53 from luongnhattruong/improve_log_for_path_prefix
Browse files Browse the repository at this point in the history
Add log info in case of no file found by path_prefix
  • Loading branch information
dmikurube authored Feb 10, 2025
2 parents a86ca68 + 71978bc commit 797ca1c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/embulk/input/gcs/GcsFileInputPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.embulk.util.config.ConfigMapperFactory;
import org.embulk.util.config.TaskMapper;
import org.embulk.util.config.units.LocalFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;
Expand All @@ -23,6 +25,7 @@ public class GcsFileInputPlugin
.addDefaultModules().build();
public static final ConfigMapper CONFIG_MAPPER = CONFIG_MAPPER_FACTORY.createConfigMapper();
public static final TaskMapper TASK_MAPPER = CONFIG_MAPPER_FACTORY.createTaskMapper();
private static final Logger logger = LoggerFactory.getLogger(GcsFileInputPlugin.class);
@Override
public ConfigDiff transaction(ConfigSource config,
FileInputPlugin.Control control)
Expand Down Expand Up @@ -62,6 +65,9 @@ else if (AuthUtils.AuthMethod.private_key.equals(task.getAuthMethod())) {
// list files recursively if path_prefix is specified
if (task.getPathPrefix().isPresent()) {
task.setFiles(GcsFileInput.listFiles(task));
if (task.getFiles().getTaskCount() == 0) {
logger.info("No file is found in the path(s) identified by path_prefix");
}
}
else {
if (task.getPathFiles().isEmpty()) {
Expand Down

0 comments on commit 797ca1c

Please sign in to comment.