[ 
https://issues.apache.org/jira/browse/GOBBLIN-1919?focusedWorklogId=887439&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-887439
 ]

ASF GitHub Bot logged work on GOBBLIN-1919:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Oct/23 18:04
            Start Date: 26/Oct/23 18:04
    Worklog Time Spent: 10m 
      Work Description: 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.
   
   would you prefer that?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 887439)
    Time Spent: 0.5h  (was: 20m)

> Simplify impl related to MR job execution (before reusing code in 
> Temporal-based exec)
> --------------------------------------------------------------------------------------
>
>                 Key: GOBBLIN-1919
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1919
>             Project: Apache Gobblin
>          Issue Type: Improvement
>          Components: gobblin-core
>            Reporter: Kip Kohn
>            Assignee: Abhishek Tiwari
>            Priority: Trivial
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to