Will-Lo commented on code in PR #3784:
URL: https://github.com/apache/gobblin/pull/3784#discussion_r1373724345
##########
gobblin-utility/src/main/java/org/apache/gobblin/util/JobLauncherUtils.java:
##########
@@ -123,6 +126,20 @@ public static List<WorkUnit>
flattenWorkUnits(Collection<WorkUnit> workUnits) {
return flattenedWorkUnits;
}
+ /** @return flattened list of {@link WorkUnit}s loaded from `path`, which
may possibly hold a multi-work unit */
+ public static List<WorkUnit> loadFlattenedWorkUnits(FileSystem fs, Path
path) throws IOException {
+ WorkUnit workUnit = path.getName().endsWith(MULTI_WORK_UNIT_FILE_EXTENSION)
+ ? MultiWorkUnit.createEmpty()
+ : WorkUnit.createEmpty();
+ SerializationUtils.deserializeState(fs, path, workUnit);
+
+ if (workUnit instanceof MultiWorkUnit) {
+ return JobLauncherUtils.flattenWorkUnits(((MultiWorkUnit)
workUnit).getWorkUnits());
+ } else {
Review Comment:
I'd prefer the current over ternary, I guess because there's quite a bit of
casting involved here so it's not as easy to follow what's going on.
--
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]