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

zhongjiajie pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/dolphinscheduler-sdk-python.git


The following commit(s) were added to refs/heads/main by this push:
     new 4f80133  fix: adapt the latest java trigger worflow code (#156)
4f80133 is described below

commit 4f801338a16a702f93ecc3f95660dd4eef675f85
Author: Jay Chung <[email protected]>
AuthorDate: Wed Jan 22 17:51:26 2025 +0800

    fix: adapt the latest java trigger worflow code (#156)
    
    * Change docker build command
    * fix according to latest PythongGateway.java code
---
 .github/workflows/ci.yaml                    |  9 +++------
 src/pydolphinscheduler/constants.py          |  2 +-
 src/pydolphinscheduler/core/workflow.py      |  2 --
 src/pydolphinscheduler/java_gateway.py       |  4 ----
 src/pydolphinscheduler/tasks/dependent.py    |  4 ++--
 src/pydolphinscheduler/tasks/sub_workflow.py |  4 ++--
 tests/core/test_yaml_workflow.py             |  2 +-
 tests/tasks/test_dependent.py                | 14 +++++++-------
 tests/tasks/test_sub_workflow.py             |  6 +++---
 9 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 2a3424c..9d1b94e 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -197,14 +197,11 @@ jobs:
       # Switch to project root directory to run mvnw command
       - name: Build Image
         working-directory: dolphinscheduler
-
         run: |
           ./mvnw -B clean install \
-          -Dmaven.test.skip \
-          -Dmaven.javadoc.skip \
-          -Dcheckstyle.skip=true \
-          -Pdocker,release -Ddocker.tag=ci \
-          -pl dolphinscheduler-standalone-server -am
+              -Dmaven.test.skip=true \
+              -Dspotless.skip=true \
+              -Pdocker,staging -Ddocker.tag=ci
       - name: Set up Python
         uses: actions/setup-python@v4
         with:
diff --git a/src/pydolphinscheduler/constants.py 
b/src/pydolphinscheduler/constants.py
index b28d3b6..49059db 100644
--- a/src/pydolphinscheduler/constants.py
+++ b/src/pydolphinscheduler/constants.py
@@ -56,7 +56,7 @@ class TaskType(str):
     HTTP = "HTTP"
     PYTHON = "PYTHON"
     SQL = "SQL"
-    SUB_WORKFLOW = "SUB_PROCESS"
+    SUB_WORKFLOW = "SUB_WORKFLOW"
     PROCEDURE = "PROCEDURE"
     DATAX = "DATAX"
     DEPENDENT = "DEPENDENT"
diff --git a/src/pydolphinscheduler/core/workflow.py 
b/src/pydolphinscheduler/core/workflow.py
index 7fac15b..f191612 100644
--- a/src/pydolphinscheduler/core/workflow.py
+++ b/src/pydolphinscheduler/core/workflow.py
@@ -484,9 +484,7 @@ class Workflow(Base):
             self._user,
             self._project,
             self.name,
-            "",
             self.worker_group,
             self.warning_type,
             self.warning_group_id,
-            24 * 3600,
         )
diff --git a/src/pydolphinscheduler/java_gateway.py 
b/src/pydolphinscheduler/java_gateway.py
index 43e3445..e848475 100644
--- a/src/pydolphinscheduler/java_gateway.py
+++ b/src/pydolphinscheduler/java_gateway.py
@@ -299,22 +299,18 @@ class GatewayEntryPoint:
         user_name: str,
         project_name: str,
         workflow_name: str,
-        cron_time: str,
         worker_group: str,
         warning_type: str,
         warning_group_id: int,
-        timeout: int,
     ):
         """Exec workflow instance through java gateway."""
         return self.gateway.entry_point.execWorkflowInstance(
             user_name,
             project_name,
             workflow_name,
-            cron_time,
             worker_group,
             warning_type,
             warning_group_id,
-            timeout,
         )
 
 
diff --git a/src/pydolphinscheduler/tasks/dependent.py 
b/src/pydolphinscheduler/tasks/dependent.py
index be716f6..2894373 100644
--- a/src/pydolphinscheduler/tasks/dependent.py
+++ b/src/pydolphinscheduler/tasks/dependent.py
@@ -135,8 +135,8 @@ class DependentItem(Base):
 
     @property
     def definition_code(self) -> str:
-        """Get dependent definition code."""
-        return self.get_code_from_gateway().get("processDefinitionCode")
+        """Get dependent workflow code."""
+        return self.get_code_from_gateway().get("workflowDefinitionCode")
 
     @property
     def dep_task_code(self) -> str:
diff --git a/src/pydolphinscheduler/tasks/sub_workflow.py 
b/src/pydolphinscheduler/tasks/sub_workflow.py
index 4671146..a9f072d 100644
--- a/src/pydolphinscheduler/tasks/sub_workflow.py
+++ b/src/pydolphinscheduler/tasks/sub_workflow.py
@@ -28,14 +28,14 @@ from pydolphinscheduler.java_gateway import gateway
 class SubWorkflow(BatchTask):
     """Task SubWorkflow object, declare behavior for SubWorkflow task to 
dolphinscheduler."""
 
-    _task_custom_attr = {"process_definition_code"}
+    _task_custom_attr = {"workflow_definition_code"}
 
     def __init__(self, name: str, workflow_name: str, *args, **kwargs):
         super().__init__(name, TaskType.SUB_WORKFLOW, *args, **kwargs)
         self.workflow_name = workflow_name
 
     @property
-    def process_definition_code(self) -> str:
+    def workflow_definition_code(self) -> str:
         """Get workflow code, a wrapper for :func:`get_workflow_info`.
 
         We can not change this function name to workflow_code, because it is a 
keyword used in
diff --git a/tests/core/test_yaml_workflow.py b/tests/core/test_yaml_workflow.py
index 083f822..45a35f0 100644
--- a/tests/core/test_yaml_workflow.py
+++ b/tests/core/test_yaml_workflow.py
@@ -190,7 +190,7 @@ def test_get_error(task_type):
     "pydolphinscheduler.tasks.dependent.DependentItem.get_code_from_gateway",
     return_value={
         "projectCode": 0,
-        "processDefinitionCode": 0,
+        "workflowDefinitionCode": 0,
         "taskDefinitionCode": 0,
     },
 )
diff --git a/tests/tasks/test_dependent.py b/tests/tasks/test_dependent.py
index 4be4501..0e41a9c 100644
--- a/tests/tasks/test_dependent.py
+++ b/tests/tasks/test_dependent.py
@@ -78,7 +78,7 @@ TEST_OPERATOR_LIST = ("AND", "OR")
     "pydolphinscheduler.tasks.dependent.DependentItem.get_code_from_gateway",
     return_value={
         "projectCode": TEST_PROJECT_CODE,
-        "processDefinitionCode": TEST_DEFINITION_CODE,
+        "workflowDefinitionCode": TEST_DEFINITION_CODE,
         "taskDefinitionCode": TEST_TASK_CODE,
     },
 )
@@ -117,7 +117,7 @@ def test_dependent_item_get_define(mock_task_info, 
dep_date, dep_cycle):
     "pydolphinscheduler.tasks.dependent.DependentItem.get_code_from_gateway",
     return_value={
         "projectCode": TEST_PROJECT_CODE,
-        "processDefinitionCode": TEST_DEFINITION_CODE,
+        "workflowDefinitionCode": TEST_DEFINITION_CODE,
         "taskDefinitionCode": TEST_TASK_CODE,
     },
 )
@@ -212,7 +212,7 @@ def test_dependent_item_code_parameter(task_name: dict, 
result: str | None):
     "pydolphinscheduler.tasks.dependent.DependentItem.get_code_from_gateway",
     return_value={
         "projectCode": TEST_PROJECT_CODE,
-        "processDefinitionCode": TEST_DEFINITION_CODE,
+        "workflowDefinitionCode": TEST_DEFINITION_CODE,
         "taskDefinitionCode": TEST_TASK_CODE,
     },
 )
@@ -353,7 +353,7 @@ def test_dependent_operator_set_define_error(mock_code, 
arg_list):
     "pydolphinscheduler.tasks.dependent.DependentItem.get_code_from_gateway",
     return_value={
         "projectCode": TEST_PROJECT_CODE,
-        "processDefinitionCode": TEST_DEFINITION_CODE,
+        "workflowDefinitionCode": TEST_DEFINITION_CODE,
         "taskDefinitionCode": TEST_TASK_CODE,
     },
 )
@@ -552,7 +552,7 @@ def test_operator_dependent_item(
     "pydolphinscheduler.tasks.dependent.DependentItem.get_code_from_gateway",
     return_value={
         "projectCode": TEST_PROJECT_CODE,
-        "processDefinitionCode": TEST_DEFINITION_CODE,
+        "workflowDefinitionCode": TEST_DEFINITION_CODE,
         "taskDefinitionCode": TEST_TASK_CODE,
     },
 )
@@ -682,7 +682,7 @@ def get_dep_task_list(*operator):
     "pydolphinscheduler.tasks.dependent.DependentItem.get_code_from_gateway",
     return_value={
         "projectCode": TEST_PROJECT_CODE,
-        "processDefinitionCode": TEST_DEFINITION_CODE,
+        "workflowDefinitionCode": TEST_DEFINITION_CODE,
         "taskDefinitionCode": TEST_TASK_CODE,
     },
 )
@@ -738,7 +738,7 @@ def test_operator_dependent_task_list_multi_dependent_list(
     "pydolphinscheduler.tasks.dependent.DependentItem.get_code_from_gateway",
     return_value={
         "projectCode": TEST_PROJECT_CODE,
-        "processDefinitionCode": TEST_DEFINITION_CODE,
+        "workflowDefinitionCode": TEST_DEFINITION_CODE,
         "taskDefinitionCode": TEST_TASK_CODE,
     },
 )
diff --git a/tests/tasks/test_sub_workflow.py b/tests/tasks/test_sub_workflow.py
index 5963698..9c4d454 100644
--- a/tests/tasks/test_sub_workflow.py
+++ b/tests/tasks/test_sub_workflow.py
@@ -35,7 +35,7 @@ TEST_WORKFLOW_NAME = "simple-test-workflow"
         (
             {"workflow_name": TEST_SUB_WORKFLOW_NAME},
             {
-                "processDefinitionCode": TEST_SUB_WORKFLOW_CODE,
+                "workflowDefinitionCode": TEST_SUB_WORKFLOW_CODE,
                 "localParams": [],
                 "resourceList": [],
                 "dependence": {},
@@ -83,7 +83,7 @@ def test_sub_workflow_get_define(mock_workflow_definition):
     expect_task_params = {
         "resourceList": [],
         "localParams": [],
-        "processDefinitionCode": TEST_SUB_WORKFLOW_CODE,
+        "workflowDefinitionCode": TEST_SUB_WORKFLOW_CODE,
         "dependence": {},
         "conditionResult": {"successNode": [""], "failedNode": [""]},
         "waitStartTimeout": {},
@@ -115,7 +115,7 @@ def 
test_deprecated_sub_workflow_get_define(mock_workflow_definition):
     expect_task_params = {
         "resourceList": [],
         "localParams": [],
-        "processDefinitionCode": TEST_SUB_WORKFLOW_CODE,
+        "workflowDefinitionCode": TEST_SUB_WORKFLOW_CODE,
         "dependence": {},
         "conditionResult": {"successNode": [""], "failedNode": [""]},
         "waitStartTimeout": {},

Reply via email to