phet commented on code in PR #3784:
URL: https://github.com/apache/gobblin/pull/3784#discussion_r1372649990
##########
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 agree it's not necessary, but I find the parallel indentation of
`if`/`else` to be clearer, hence preferable. TBH, I almost went w/ the ternary
operator... but it seemed harder to read.
--
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]