From 24747b3dae88b33f4f6d836aaa22b82cb7aac705 Mon Sep 17 00:00:00 2001 From: Jiajie Zhong Date: Tue, 28 Dec 2021 23:46:22 +0800 Subject: [PATCH] [python] Fix task switch set global parameter (#7693) * [python] Fix task switch set global parameter * Change name --- .../pydolphinscheduler/examples/task_switch_example.py | 8 ++++++++ .../src/pydolphinscheduler/core/process_definition.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-python/pydolphinscheduler/examples/task_switch_example.py b/dolphinscheduler-python/pydolphinscheduler/examples/task_switch_example.py index b47b8e3bfd..9a13854887 100644 --- a/dolphinscheduler-python/pydolphinscheduler/examples/task_switch_example.py +++ b/dolphinscheduler-python/pydolphinscheduler/examples/task_switch_example.py @@ -36,6 +36,14 @@ from pydolphinscheduler.tasks.switch import Branch, Default, Switch, SwitchCondi with ProcessDefinition( name="task_switch_example", tenant="tenant_exists", + param=[ + { + "prop": "var", + "direct": "IN", + "type": "VARCHAR", + "value": "1" + } + ] ) as pd: parent = Shell(name="parent", command="echo parent") switch_child_1 = Shell(name="switch_child_1", command="echo switch_child_1") diff --git a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py index 711cfb0b0f..f6fab01d3d 100644 --- a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py +++ b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py @@ -332,7 +332,7 @@ class ProcessDefinition(Base): self._project, self.name, str(self.description) if self.description else "", - str(self.param) if self.param else None, + json.dumps(self.param) if self.param else None, json.dumps(self.schedule_json) if self.schedule_json else None, json.dumps(self.task_location), self.timeout,