You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/01/16 18:19:53 UTC

[incubator-hop] branch master updated: HOP-2429 : When using 'workflow executor' the metadata is not loaded (#560)

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

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git


The following commit(s) were added to refs/heads/master by this push:
     new f3567c7   HOP-2429 : When using 'workflow executor' the metadata is not loaded (#560)
f3567c7 is described below

commit f3567c7e632eab30018e1355887ad62b60822215
Author: Matt Casters <ma...@gmail.com>
AuthorDate: Sat Jan 16 19:19:45 2021 +0100

     HOP-2429 : When using 'workflow executor' the metadata is not loaded (#560)
    
    * HOP-2429 : When using 'workflow executor' the metadata is not loaded correctly
    
    * HOP-2429 : When using 'workflow executor' the metadata is not loaded correctly
    
    * HOP-2429 : When using 'workflow executor' the metadata is not loaded correctly
---
 .../workflowexecutor/WorkflowExecutor.java         |  2 +-
 .../workflowexecutor/WorkflowExecutorMeta.java     | 11 ++---
 .../parameters_and_variables/0002-workflow.hwf     | 52 ++++++++++++++++++++--
 ...wf => main-0002-pipeline-workflow-executor.hwf} |  2 +-
 .../metadata/rdbms/testdb.json                     | 26 +++++++++++
 5 files changed, 83 insertions(+), 10 deletions(-)

diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutor.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutor.java
index 01d88e9..c6c1620 100644
--- a/engine/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutor.java
+++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutor.java
@@ -365,7 +365,7 @@ public class WorkflowExecutor extends BaseTransform<WorkflowExecutorMeta, Workfl
       // First we need to load the mapping (pipeline)
       try {
 
-        data.executorWorkflowMeta = WorkflowExecutorMeta.loadWorkflowMeta( meta, this );
+        data.executorWorkflowMeta = WorkflowExecutorMeta.loadWorkflowMeta( meta, metadataProvider, this );
 
         // Do we have a workflow at all?
         //
diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorMeta.java
index 8c87571..0d96ddd 100644
--- a/engine/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorMeta.java
+++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorMeta.java
@@ -479,8 +479,8 @@ public class WorkflowExecutorMeta extends BaseTransformMeta implements ITransfor
     return targetTransforms.toArray( new String[ targetTransforms.size() ] );
   }
 
-  public static final synchronized WorkflowMeta loadWorkflowMeta( WorkflowExecutorMeta executorMeta, IVariables variables ) throws HopException {
-    return loadWorkflowMeta( executorMeta, null, variables );
+  public static final synchronized WorkflowMeta loadWorkflowMeta( WorkflowExecutorMeta executorMeta, IVariables variables, IHopMetadataProvider metadataProvider ) throws HopException {
+    return loadWorkflowMeta( executorMeta, metadataProvider, variables );
   }
 
   public static final synchronized WorkflowMeta loadWorkflowMeta( WorkflowExecutorMeta executorMeta, IHopMetadataProvider metadataProvider, IVariables variables ) throws HopException {
@@ -566,13 +566,14 @@ public class WorkflowExecutorMeta extends BaseTransformMeta implements ITransfor
    * without using PowerMock
    *
    * @param executorMeta
+   * @param metadataProvider
    * @param variables
    * @return WorkflowMeta
    * @throws HopException
    */
-  WorkflowMeta loadWorkflowMetaProxy( WorkflowExecutorMeta executorMeta,
+  WorkflowMeta loadWorkflowMetaProxy( WorkflowExecutorMeta executorMeta, IHopMetadataProvider metadataProvider,
                                  IVariables variables ) throws HopException {
-    return loadWorkflowMeta( executorMeta, variables );
+    return loadWorkflowMeta( executorMeta, metadataProvider, variables );
   }
 
   @Override
@@ -587,7 +588,7 @@ public class WorkflowExecutorMeta extends BaseTransformMeta implements ITransfor
       //
       // First load the executor workflow metadata...
       //
-      WorkflowMeta executorWorkflowMeta = loadWorkflowMetaProxy( this, variables );
+      WorkflowMeta executorWorkflowMeta = loadWorkflowMetaProxy( this, metadataProvider, variables );
 
       // Also go down into the mapping pipeline and export the files
       // there. (mapping recursively down)
diff --git a/integration-tests/parameters_and_variables/0002-workflow.hwf b/integration-tests/parameters_and_variables/0002-workflow.hwf
index f2e8c66..f234638 100644
--- a/integration-tests/parameters_and_variables/0002-workflow.hwf
+++ b/integration-tests/parameters_and_variables/0002-workflow.hwf
@@ -28,8 +28,6 @@
       <description/>
       <type>SPECIAL</type>
       <attributes/>
-      <start>Y</start>
-      <dummy>N</dummy>
       <repeat>N</repeat>
       <schedulerType>0</schedulerType>
       <intervalSeconds>0</intervalSeconds>
@@ -55,7 +53,37 @@ TEST2_PARAMETER2 = >${TEST2_PARAMETER2}&lt;</logmessage>
       <logsubject>Log parameter value</logsubject>
       <parallel>N</parallel>
       <nr>0</nr>
-      <xloc>320</xloc>
+      <xloc>368</xloc>
+      <yloc>96</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Check DB connections</name>
+      <description/>
+      <type>CHECK_DB_CONNECTIONS</type>
+      <attributes/>
+      <connections>
+        <connection>
+          <name>testdb</name>
+          <waitfor>0</waitfor>
+          <waittime>millisecond</waittime>
+        </connection>
+      </connections>
+      <parallel>N</parallel>
+      <nr>0</nr>
+      <xloc>560</xloc>
+      <yloc>96</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Abort workflow</name>
+      <description/>
+      <type>ABORT</type>
+      <attributes/>
+      <message>Problem checking testdb connection</message>
+      <parallel>N</parallel>
+      <nr>0</nr>
+      <xloc>720</xloc>
       <yloc>96</yloc>
       <attributes_hac/>
     </action>
@@ -70,6 +98,24 @@ TEST2_PARAMETER2 = >${TEST2_PARAMETER2}&lt;</logmessage>
       <evaluation>Y</evaluation>
       <unconditional>Y</unconditional>
     </hop>
+    <hop>
+      <from>Log parameter value</from>
+      <to>Check DB connections</to>
+      <from_nr>0</from_nr>
+      <to_nr>0</to_nr>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+    <hop>
+      <from>Check DB connections</from>
+      <to>Abort workflow</to>
+      <from_nr>0</from_nr>
+      <to_nr>0</to_nr>
+      <enabled>Y</enabled>
+      <evaluation>N</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
   </hops>
   <notepads>
   </notepads>
diff --git a/integration-tests/parameters_and_variables/main-0002-pipeline-job-executor.hwf b/integration-tests/parameters_and_variables/main-0002-pipeline-workflow-executor.hwf
similarity index 99%
rename from integration-tests/parameters_and_variables/main-0002-pipeline-job-executor.hwf
rename to integration-tests/parameters_and_variables/main-0002-pipeline-workflow-executor.hwf
index 59d9f1c..9642495 100644
--- a/integration-tests/parameters_and_variables/main-0002-pipeline-job-executor.hwf
+++ b/integration-tests/parameters_and_variables/main-0002-pipeline-workflow-executor.hwf
@@ -94,7 +94,7 @@ for (var i = 0 ; i&lt;expectedValues.length ; i++) {
 ok;</script>
       <parallel>N</parallel>
       <nr>0</nr>
-      <xloc>528</xloc>
+      <xloc>464</xloc>
       <yloc>96</yloc>
       <attributes_hac/>
     </action>
diff --git a/integration-tests/parameters_and_variables/metadata/rdbms/testdb.json b/integration-tests/parameters_and_variables/metadata/rdbms/testdb.json
new file mode 100644
index 0000000..22de0a7
--- /dev/null
+++ b/integration-tests/parameters_and_variables/metadata/rdbms/testdb.json
@@ -0,0 +1,26 @@
+{
+  "rdbms": {
+    "H2": {
+      "databaseName": "${java.io.tmpdir}/testdb",
+      "pluginId": "H2",
+      "accessType": 0,
+      "hostname": "",
+      "password": "Encrypted ",
+      "port": "",
+      "pluginName": "H2",
+      "attributes": {
+        "SUPPORTS_TIMESTAMP_DATA_TYPE": "Y",
+        "QUOTE_ALL_FIELDS": "N",
+        "SUPPORTS_BOOLEAN_DATA_TYPE": "Y",
+        "FORCE_IDENTIFIERS_TO_LOWERCASE": "N",
+        "PRESERVE_RESERVED_WORD_CASE": "Y",
+        "SQL_CONNECT": "",
+        "FORCE_IDENTIFIERS_TO_UPPERCASE": "N",
+        "PREFERRED_SCHEMA_NAME": ""
+      },
+      "manualUrl": "",
+      "username": ""
+    }
+  },
+  "name": "testdb"
+}
\ No newline at end of file