@ -14,10 +14,10 @@ DolphinScheduler allows parameter transfer between tasks. Currently, transfer di
* [SQL](../task/sql.md)
* [Procedure](../task/stored-procedure.md)
* [Python](../task/python.md)
* [SubProcess](../task/sub-process.md)
* [SubWorkflow](../task/sub-workflow)
* [Kubernetes](../task/kubernetes.md)
When defining an upstream node, if there is a need to transmit the result of that node to a dependency related downstream node. You need to set an `OUT` direction parameter to [Custom Parameters] of the [Current Node Settings]. If it is a SubProcess node, there is no need to set a parameter in [Current Node Settings], but an `OUT` direction parameter needs to be set in the workflow definition of the subprocess.
When defining an upstream node, if there is a need to transmit the result of that node to a dependency related downstream node. You need to set an `OUT` direction parameter to [Custom Parameters] of the [Current Node Settings]. If it is a sub-workflow node, there is no need to set a parameter in [Current Node Settings], but an `OUT` direction parameter needs to be set in the workflow definition of the sub-workflow.
The value of upstream parameter can be updated in downstream node in the same way as [setting parameter](#create-a-shell-task-and-set-parameters).
@ -94,29 +94,29 @@ For example
Attention: When the variable value contains the `\n` identifier, such as ` value = "hello \n world" `, value needs to be carried out in a special way. You need to use `print('${setValue(key=%s)}' % repr(value))`, otherwise the argument cannot be passed to the subsequent flow.
#### Pass parameter from SubProcess task to downstream
#### Pass parameter from SubWorkflow task to downstream
In the workflow definition of the subprocess, define `OUT` direction parameters as output parameters, and these parameters can be passed to the downstream tasks of the subprocess node.
In the workflow definition of the sub-workflow, define `OUT` direction parameters as output parameters, and these parameters can be passed to the downstream tasks of the sub-workflow node.
Create an A task in the workflow definition of the subprocess, add var1 and var2 parameters to the custom parameters, and write the following script:
Create an A task in the workflow definition of the sub-workflow, add var1 and var2 parameters to the custom parameters, and write the following script:
Although the two parameters var1 and var2 are output in the A task, only the `OUT` parameter var1 is defined in the workflow definition, and the downstream task successfully outputs var1. It proves that the var1 parameter is passed in the workflow with reference to the expected value.
| Child node | It is the workflow definition of the selected sub-process. Enter the child node in the upper right corner to jump to the workflow definition of the selected sub-process. |
| Child node | It is the workflow definition of the selected sub-workflow. Enter the child node in the upper right corner to jump to the workflow definition of the selected sub-workflow. |
## Task Example
@ -28,17 +28,17 @@ This example simulates a common task type, here we use a child node task to reca
Create a shell task to print "hello" and define the workflow as `test_dag01`.
To use the sub_workflow, you need to create the sub-node task, which is the workflow `test_dag01` we created in the first step. After that, as shown in the diagram below, select the corresponding sub-node in position ⑤.
After creating the sub_workflow, create a corresponding shell task for printing "world" and link both together. Save the current workflow and run it to get the expected result.