phet commented on code in PR #3943:
URL: https://github.com/apache/gobblin/pull/3943#discussion_r1591312458


##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/proc/LaunchDagProc.java:
##########
@@ -63,8 +63,12 @@ protected Optional<Dag<JobExecutionPlan>> 
initialize(DagManagementStateStore dag
     try {
       FlowSpec flowSpec = 
dagManagementStateStore.getFlowSpec(FlowSpec.Utils.createFlowSpecUri(getDagId().getFlowId()));
       flowSpec.addProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, 
getDagId().getFlowExecutionId());
-      return 
this.flowCompilationValidationHelper.createExecutionPlanIfValid(flowSpec).toJavaUtil();
-    } catch (URISyntaxException | SpecNotFoundException | InterruptedException 
e) {
+      Optional<Dag<JobExecutionPlan>> dag = 
this.flowCompilationValidationHelper.createExecutionPlanIfValid(flowSpec).toJavaUtil();
+      if (dag.isPresent()) {
+        dagManagementStateStore.checkpointDag(dag.get());
+      }
+      return dag;

Review Comment:
   not sure if I'm missing something... why would you return `Optional.empty` 
explicitly?  this should be enough:
   ```
   Optional<Dag<JobExecutionPlan>> dag = 
this.flowCompilationValidationHelper.createExecutionPlanIfValid(flowSpec).toJavaUtil();
   ```
   it would add tautological boiler-plate to write something like:
   ```
   if (dag.isPresent()) {
     ...
     return dag;
   } else {
     return Optional.empty();
   }
   ```
   is that what you're suggesting?
   
   seems as inadvisable as replacing:
   ```
   return foo > bar;
   ```
   with
   ```
   return foo > bar ? true : false;
   ```



-- 
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]

Reply via email to