Skip to content

Commit

Permalink
[Improvement-16586][Doc] Rename sub-process to sub-workflow in docs (#…
Browse files Browse the repository at this point in the history
…16587)

---------

Co-authored-by: Gallardot <[email protected]>
  • Loading branch information
SbloodyS and Gallardot authored Sep 9, 2024
1 parent 20d96be commit e88eb7f
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 38 deletions.
8 changes: 4 additions & 4 deletions docs/configs/docsdev.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export default {
link: '/en-us/docs/dev/user_doc/guide/task/shell.html',
},
{
title: 'SubProcess',
link: '/en-us/docs/dev/user_doc/guide/task/sub-process.html',
title: 'SubWorkflow',
link: '/en-us/docs/dev/user_doc/guide/task/sub-workflow.html',
},
{
title: 'Dynamic',
Expand Down Expand Up @@ -822,8 +822,8 @@ export default {
link: '/zh-cn/docs/dev/user_doc/guide/task/shell.html',
},
{
title: 'SubProcess',
link: '/zh-cn/docs/dev/user_doc/guide/task/sub-process.html',
title: 'SubWorkflow',
link: '/zh-cn/docs/dev/user_doc/guide/task/sub-workflow.html',
},
{
title: 'Dynamic',
Expand Down
24 changes: 12 additions & 12 deletions docs/docs/en/guide/parameter/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down Expand Up @@ -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:

![context-subprocess01](../../../../img/new_ui/dev/parameter/context-subprocess01.png)
![context-sub-workflow01](../../../../img/new_ui/dev/parameter/context-sub-workflow01.png)

Save the subprocess_example1 workflow and set the global parameters var1.
Save the sub-workflow_example1 workflow and set the global parameters var1.

![context-subprocess02](../../../../img/new_ui/dev/parameter/context-subprocess02.png)
![context-sub-workflow02](../../../../img/new_ui/dev/parameter/context-sub-workflow02.png)

Create a sub_workflow task in a new workflow, and use the subprocess_example1 workflow as the sub-node.
Create a sub_workflow task in a new workflow, and use the sub-workflow_example1 workflow as the sub-node.

![context-subprocess03](../../../../img/new_ui/dev/parameter/context-subprocess03.png)
![context-sub-workflow03](../../../../img/new_ui/dev/parameter/context-sub-workflow03.png)

Create a shell task as a downstream task of the sub_workflow task, and write the following script:

![context-subprocess04](../../../../img/new_ui/dev/parameter/context-subprocess04.png)
![context-sub-workflow04](../../../../img/new_ui/dev/parameter/context-sub-workflow04.png)

Save the workflow and run it. The result of the downstream task is as follows:

![context-subprocess05](../../../../img/new_ui/dev/parameter/context-subprocess05.png)
![context-sub-workflow05](../../../../img/new_ui/dev/parameter/context-sub-workflow05.png)

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.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# SubProcess Node
# SubWorkflow Node

## Overview

The sub-process node is to execute an external workflow definition as a task node.
The sub-workflow node is to execute an external workflow definition as a task node.

## Create Task

- Click `Project Management -> Project Name -> Workflow Definition`, and click the `Create Workflow` button to enter the DAG editing page.
- Drag from the toolbar <img src="../../../../img/tasks/icons/sub_workflow.png" width="15"/> task node to canvas to create a new SubProcess task.
- Drag from the toolbar <img src="../../../../img/tasks/icons/sub_workflow.png" width="15"/> task node to canvas to create a new SubWorkflow task.

## Task Parameter

Expand All @@ -16,9 +16,9 @@ The sub-process node is to execute an external workflow definition as a task nod

- Please refer to [DolphinScheduler Task Parameters Appendix](appendix.md) `Default Task Parameters` section for default parameters.

| **Parameter** | **Description** |
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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. |
| **Parameter** | **Description** |
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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

Expand All @@ -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`.

![subprocess_task01](../../../../img/tasks/demo/subprocess_task01.png)
![subworkflow_task01](../../../../img/tasks/demo/subworkflow_task01.png)

## Create the Sub_workflow task

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 ⑤.

![subprocess_task02](../../../../img/tasks/demo/subprocess_task02.png)
![subworkflow_task02](../../../../img/tasks/demo/subworkflow_task02.png)

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.

![subprocess_task03](../../../../img/tasks/demo/subprocess_task03.png)
![subworkflow_task03](../../../../img/tasks/demo/subworkflow_task03.png)

## Note

Expand Down
20 changes: 10 additions & 10 deletions docs/docs/zh/guide/parameter/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ DolphinScheduler 允许在任务间进行参数传递,目前传递方向仅支
* [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)

当定义上游节点时,如果有需要将该节点的结果传递给有依赖关系的下游节点,需要在【当前节点设置】的【自定义参数】设置一个方向是 OUT 的变量。如果是 SubProcess 节点无需在【当前节点设置】中设置变量,需要在子流程的工作流定义中设置一个方向是 OUT 的变量。
当定义上游节点时,如果有需要将该节点的结果传递给有依赖关系的下游节点,需要在【当前节点设置】的【自定义参数】设置一个方向是 OUT 的变量。如果是 SubWorkflow 节点无需在【当前节点设置】中设置变量,需要在子流程的工作流定义中设置一个方向是 OUT 的变量。

上游传递的参数可以在下游节点中被更新,更新方法与[设置参数](#创建-shell-任务并设置参数)相同。

Expand Down Expand Up @@ -93,29 +93,29 @@ Node_mysql 运行结果如下:

注意: 当变量 value 中含有 `\n` 标识,如 `value = "hello \n world"`, 则需要将 value 进行特殊进行,需要使用 `print('${setValue(key=%s)}' % repr(value))`, 否则参数无法传递到后面的流程。

#### SubProcess 任务传递参数
#### SubWorkflow 任务传递参数

在子流程的工作流定义中定义方向是 OUT 的变量作为输出参数,可以将这些参数传递到子流程节点的下游任务。

在子流程的工作流定义中创建 A 任务,在自定义参数中添加 var1 和 var2 参数,并编写如下脚本:

![context-subprocess01](../../../../img/new_ui/dev/parameter/context-subprocess01.png)
![context-sub-workflow01](../../../../img/new_ui/dev/parameter/context-sub-workflow01.png)

保存 subprocess_example1 工作流,设置全局参数 var1。
保存 sub-workflow_example1 工作流,设置全局参数 var1。

![context-subprocess02](../../../../img/new_ui/dev/parameter/context-subprocess02.png)
![context-sub-workflow02](../../../../img/new_ui/dev/parameter/context-sub-workflow02.png)

在新的工作流中创建 sub_workflow 任务,使用 subprocess_example1 工作流作为子节点。
在新的工作流中创建 sub_workflow 任务,使用 sub-workflow_example1 工作流作为子节点。

![context-subprocess03](../../../../img/new_ui/dev/parameter/context-subprocess03.png)
![context-sub-workflow03](../../../../img/new_ui/dev/parameter/context-sub-workflow03.png)

创建一个 shell 任务作为 sub_workflow 任务的下游任务,并编写如下脚本:

![context-subprocess04](../../../../img/new_ui/dev/parameter/context-subprocess04.png)
![context-sub-workflow04](../../../../img/new_ui/dev/parameter/context-sub-workflow04.png)

保存该工作流并运行,下游任务运行结果如下:

![context-subprocess05](../../../../img/new_ui/dev/parameter/context-subprocess05.png)
![context-sub-workflow05](../../../../img/new_ui/dev/parameter/context-sub-workflow05.png)

虽然在 A 任务中输出 var1 和 var2 两个参数,但是工作流定义中只定义了 var1 的 OUT 变量,下游任务成功输出 var1,证明var1 参数参照预期的值在该工作流中传递。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@

创建一个 shell 任务,用于打印 “hello”。并为该工作流定义为 test_dag01。

![subprocess_task01](../../../../img/tasks/demo/subprocess_task01.png)
![subworkflow_task01](../../../../img/tasks/demo/subworkflow_task01.png)

### 创建 sub_workflow 任务

在使用 sub_workflow 的过程中,需要创建所需的子结点任务,也就是我们第一步所创建的 test_dag01 工作流。然后如下图所示,在 ⑤ 的位置选择对应的子结点即可。

![subprocess_task02](../../../../img/tasks/demo/subprocess_task02.png)
![subworkflow_task02](../../../../img/tasks/demo/subworkflow_task02.png)

创建 sub_workflow 完成之后,再创建一个对应的 shell 任务,用于打印 “world”,并将二者连接起来。保存当前工作流,并上线运行,即可得到想要的结果。

![subprocess_task03](../../../../img/tasks/demo/subprocess_task03.png)
![subworkflow_task03](../../../../img/tasks/demo/subworkflow_task03.png)

## 注意事项

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit e88eb7f

Please sign in to comment.