-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GOBBLIN-2147] Added lookback time fetch in partitioned filesource #4044
base: master
Are you sure you want to change the base?
Conversation
/** | ||
* DEFAULT LOOKBACK TIME KEY property | ||
*/ | ||
public static final String DEFAULT_COPY_LOOKBACK_TIME_KEY = "copy.lookbackTime"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the datapacks MP, this config is used to set another config (configX), which is used at various places in gobblin to find the lookback period. Please use that configX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property is "gobblin.copy.recursive.lookback.time", isn't it will be confusing to use other DatasetFinder config in other finder class ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not 100% clear here...
is the issue that:
- the same prop name is already in use elsewhere so we should avoid conflicting?
- that a config w/ similar semantics already exists, and we might intentionally borrow it here for uniformity?
- or something else...?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4044 +/- ##
============================================
+ Coverage 38.79% 41.14% +2.35%
- Complexity 1599 2204 +605
============================================
Files 388 480 +92
Lines 15998 20360 +4362
Branches 1585 2355 +770
============================================
+ Hits 6207 8378 +2171
- Misses 9293 11090 +1797
- Partials 498 892 +394 ☔ View full report in Codecov by Sentry. |
@@ -129,8 +134,15 @@ public List<FileInfo> getFilesToProcess(long minWatermark, int maxFilesToReturn) | |||
new FileInfo(fileStatus.getPath().toString(), fileStatus.getLen(), date.getMillis(), partitionPath)); | |||
} | |||
} | |||
|
|||
if (growthTracker.isAnotherMilestone(iteration++)) { | |||
LOG.info("~{}~ collected files to process", filesToProcess.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this log the same number of files every time there's a milestone? I believe you intend to log how many files were processed thus far when reaching each milestone... correct?
ideally you might put some description in the first substitution (~{}~
) to contextualize the processing, and add the size in addition.
also, collapse adjacent logging calls, rather than keeping separate. e.g.
LOG.info("~{}~ collected {} (of {}) files to process; most-recent source path: '{}'",
description, iteration, files.size(), sourcePath);
@@ -114,6 +115,10 @@ public List<FileInfo> getFilesToProcess(long minWatermark, int maxFilesToReturn) | |||
throw new IOException("Error initializing FileSystem", e); | |||
} | |||
|
|||
GrowthMilestoneTracker growthTracker = new GrowthMilestoneTracker(); | |||
Long iteration = 0L; | |||
LOG.info("Starting processing files from {} to {}", lowWaterMarkDate, currentDay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add context about which partition of which dataset
} | ||
|
||
LOG.info("Finished processing files"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. also, let's provide the count of how many completed - filesToProcess.size()
@@ -32,6 +39,7 @@ | |||
* objects. | |||
*/ | |||
public class PartitionAwareFileRetrieverUtils { | |||
private static final Logger LOG = LoggerFactory.getLogger(PartitionAwareFileRetrieverUtils.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use the lombok annotation @Slf4j
?
* @param lookBackTime the lookback time string, which should include a numeric value followed by a time unit character. | ||
* For example, "5d" for 5 days or "10h" for 10 hours. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the flexibility here (often we've asked for two props--one for the number and the other for the time unit).
in any event, please link to the spec that documents the suffixes and what they mean (e.g. 'd', 'h', 'M', etc.)
* @return an {@link Optional} containing the {@link Duration} if the lookback time is valid, or | ||
* an empty {@link Optional} if the lookback time is invalid or cannot be parsed. | ||
*/ | ||
public static Optional<Duration> getLookbackTimeDuration(String lookBackTime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although I am a big proponent of Optional
, in this case it loses the specific errors, putting them in the log rather than "returning" them to the caller, where they might be presented in a meaningful end-user error message (rather than logs, which are for developers).
since string parsing like this regularly requires error handling, it seems reasonable and basically expected to throw an exception. you can avow in javadoc that the Duration
return value is never null
/** | ||
* DEFAULT LOOKBACK TIME KEY property | ||
*/ | ||
public static final String DEFAULT_COPY_LOOKBACK_TIME_KEY = "copy.lookbackTime"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not 100% clear here...
is the issue that:
- the same prop name is already in use elsewhere so we should avoid conflicting?
- that a config w/ similar semantics already exists, and we might intentionally borrow it here for uniformity?
- or something else...?
@@ -370,4 +394,11 @@ private long getLowWaterMark(Iterable<WorkUnitState> previousStates, String lowW | |||
protected PartitionAwareFileRetriever getRetriever() { | |||
return retriever; | |||
} | |||
|
|||
private String getLookBackTimeProp(SourceState state) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be static
Dear Gobblin maintainers,
Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
JIRA
Description
Tests
Commits