This is an automated email from the ASF dual-hosted git repository.
zhongjiajie pushed a commit to branch 2.0.2-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/2.0.2-prepare by this push:
new 24747b3 [python] Fix task switch set global parameter (#7693)
24747b3 is described below
commit 24747b3dae88b33f4f6d836aaa22b82cb7aac705
Author: Jiajie Zhong <[email protected]>
AuthorDate: Tue Dec 28 23:46:22 2021 +0800
[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 b47b8e3..9a13854 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 711cfb0..f6fab01 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,