You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by wl...@apache.org on 2023/11/22 23:27:15 UTC

(gobblin) branch master updated: Prevent NPE in `FlowCompilationValidationHelper.validateAndHandleConcurrentExecution` (#3836)

This is an automated email from the ASF dual-hosted git repository.

wlo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git


The following commit(s) were added to refs/heads/master by this push:
     new 35304e967 Prevent NPE in `FlowCompilationValidationHelper.validateAndHandleConcurrentExecution` (#3836)
35304e967 is described below

commit 35304e9676f82feeb6cc93332707a2bd9cae6b74
Author: Kip Kohn <ck...@linkedin.com>
AuthorDate: Wed Nov 22 15:27:09 2023 -0800

    Prevent NPE in `FlowCompilationValidationHelper.validateAndHandleConcurrentExecution` (#3836)
    
    * Prevent NPE in `FlowCompilationValidationHelper.validateAndHandleConcurrentExecution`
    
    * improved `MultiHopFlowCompiler` javadoc
---
 .../org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java | 4 ++--
 .../service/modules/utils/FlowCompilationValidationHelper.java        | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java
index 0f5bcf9fd..cd2de788b 100644
--- a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java
+++ b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java
@@ -202,10 +202,10 @@ public class MultiHopFlowCompiler extends BaseFlowToJobSpecCompiler {
   }
 
   /**
-   * j
    * @param spec an instance of {@link FlowSpec}.
    * @return A DAG of {@link JobExecutionPlan}s, which encapsulates the compiled {@link org.apache.gobblin.runtime.api.JobSpec}s
-   * together with the {@link SpecExecutor} where the job can be executed.
+   * together with the {@link SpecExecutor} where the job can be executed; when compilation fails, return `null`, and also add a
+   * {@link org.apache.gobblin.runtime.api.FlowSpec.CompilationError} to `spec` (after casting to a {@link FlowSpec})
    */
   @Override
   public Dag<JobExecutionPlan> compileFlow(Spec spec) {
diff --git a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/utils/FlowCompilationValidationHelper.java b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/utils/FlowCompilationValidationHelper.java
index 64c093007..78b5446bf 100644
--- a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/utils/FlowCompilationValidationHelper.java
+++ b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/utils/FlowCompilationValidationHelper.java
@@ -115,7 +115,7 @@ public final class FlowCompilationValidationHelper {
     Dag<JobExecutionPlan> jobExecutionPlanDag = specCompiler.compileFlow(spec);
 
     if (isExecutionPermitted(flowStatusGenerator, flowName, flowGroup, allowConcurrentExecution)) {
-      return Optional.of(jobExecutionPlanDag);
+      return Optional.fromNullable(jobExecutionPlanDag);
     } else {
       log.warn("Another instance of flowGroup: {}, flowName: {} running; Skipping flow execution since "
           + "concurrent executions are disabled for this flow.", flowGroup, flowName);