QuakeWang commented on code in PR #10247:
URL: https://github.com/apache/dolphinscheduler/pull/10247#discussion_r882275718


##########
docs/docs/zh/guide/task/switch.md:
##########
@@ -13,25 +15,34 @@ Switch是一个条件判断节点,依据[全局变量](../parameter/global.md)
 - 描述信息:描述该节点的功能。
 - 任务优先级:worker线程数不足时,根据优先级从高到低依次执行,优先级一样时根据先进先出原则执行。
 - Worker分组:任务分配给worker组的机器机执行,选择Default,会随机选择一台worker机执行。
+- 环境名称:安全中心中配置的环境,不配置则不使用。
+- 任务组名称:资源中心中配置的任务组,不配置则不使用。
 - 失败重试次数:任务失败重新提交的次数,支持下拉和手填。
 - 失败重试间隔:任务失败重新提交任务的时间间隔,支持下拉和手填。
-- 超时告警:勾选超时告警、超时失败,当任务超过"超时时长"后,会发送告警邮件并且任务执行失败.
-- 条件:可以为switch任务配置多个条件,当条件满足时,就会执行指定的分支,可以配置多个不同的条件来满足不同的业务
-- 分支流转:默认的流转内容,当**条件**中的内容为全部不符合要求时,则运行**分支流转**中指定的分支
+- 延时执行时间:任务延迟执行的时间。
+- 超时告警:勾选超时告警、超时失败,当任务超过"超时时长"后,会发送告警邮件并且任务执行失败。
+- 条件:可以为switch任务配置多个条件,当条件满足时,就会执行指定的分支,可以配置多个不同的条件来满足不同的业务,使用字符串判断时需要使用""。
+- 分支流转:默认的流转内容,当**条件**中的内容为全部不符合要求时,则运行**分支流转**中指定的分支。
 
 ## 详细流程
+这里使用1个 switch 任务以及3个 shell 任务来演示。
 
-假设我们三个任务,其依赖关系是 `A -> B -> [C, D]` 其中task_a是shell任务,task_b是switch任务
+### 1、创建工作流
+新建 switch 任务,以及下游的3个 shell 任务。shell 任务没有要求。
+switch 任务需要和下游任务连线配置关系后,才可以进行下游任务的选择。
 
-- 任务A中通过[全局变量](../parameter/global.md)定义了名为`id`的全局变量,声明方式为`${setValue(id=1)}`
-- 
任务B增加条件,使用上游声明的全局变量实现条件判断(注意:只要直接、非直接上游在switch运行前对全局变量赋值,switch运行时就可以获取该全局变量)。下面我们想要实现当id为1时,运行任务C,其他运行任务D
-  - 配置当全局变量`id=1`时,运行任务C。则在任务B的条件中编辑`${id} == 1`,分支流转选择`C`
-  - 对于其他任务,在分支流转中选择`D`
+![switch_01](/img/tasks/demo/switch_01.png)
 
-最终switch任务的配置如下
+### 2、设置条件
+配置条件和默认分支,满足条件会走指定分支,都不满足则走默认分支。
+条件使用了全局变量,请参考[全局变量](../parameter/global.md)。

Review Comment:
   Some details can be added here. For example, explain the value of the global 
variable set in this example, and the branch corresponding to the execution 
task.



##########
docs/docs/zh/guide/task/switch.md:
##########
@@ -1,10 +1,12 @@
 # Switch
 
-Switch是一个条件判断节点,依据[全局变量](../parameter/global.md)的值和用户所编写的表达式判断结果执行对应分支。

Review Comment:
   It is recommended to use the original expression, which is more complete.



##########
docs/docs/en/guide/task/switch.md:
##########
@@ -14,26 +15,33 @@ Drag from the toolbar <img src="/img/switch.png" 
width="20"/>  task node to canv
 - Descriptive information: Describe the function of the node.

Review Comment:
   Remove extra indent spaces



##########
docs/docs/en/guide/task/switch.md:
##########
@@ -1,6 +1,7 @@
 # Switch
 
 The switch is a conditional judgment node, decide the branch executes 
according to the value of [global variable](../parameter/global.md) and the 
expression result written by the user.
+**Note** Execute expressions using javax.script.ScriptEngine.eval.
 
 ## Create

Review Comment:
   ```suggestion
   ## Create Task
   ```



##########
docs/docs/en/guide/task/switch.md:
##########
@@ -14,26 +15,33 @@ Drag from the toolbar <img src="/img/switch.png" 
width="20"/>  task node to canv
 - Descriptive information: Describe the function of the node.
 - Task priority: When the number of worker threads is insufficient, execute in 
the order of priority from high to low, and tasks with the same priority will 
execute in a first-in first-out order.
 - Worker grouping: Assign tasks to the machines of the worker group to 
execute. If `Default` is selected, randomly select a worker machine for 
execution.
+- Environment name: The environment in Security, if not configured, it will 
not be used.
+- Task group name: The group in Resources, if not configured, it will not be 
used.
 - Times of failed retry attempts: The number of times the task failed to 
resubmit. You can select from drop-down or fill-in a number.
 - Failed retry interval: The time interval for resubmitting the task after a 
failed task. You can select from drop-down or fill-in a number.
+- Delay execution time: Task delay execution time.
 - Timeout alarm: Check the timeout alarm and timeout failure. When the task 
runs exceed the "timeout", an alarm email will send and the task execution will 
fail.
 - Condition: You can configure multiple conditions for the switch task. When 
the conditions are satisfied, execute the configured branch. You can configure 
multiple different conditions to satisfy different businesses.
 - Branch flow: The default branch flow, when all the conditions are not 
satisfied, execute this branch flow.
 
 ## Detail

Review Comment:
   ```suggestion
   ## Task Example
   ```



##########
docs/docs/en/guide/task/switch.md:
##########
@@ -1,6 +1,7 @@
 # Switch
 
 The switch is a conditional judgment node, decide the branch executes 
according to the value of [global variable](../parameter/global.md) and the 
expression result written by the user.
+**Note** Execute expressions using javax.script.ScriptEngine.eval.
 
 ## Create

Review Comment:
   - 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/switch.png" width="20"/> to the 
canvas.



##########
docs/docs/zh/guide/task/switch.md:
##########
@@ -13,25 +15,34 @@ Switch是一个条件判断节点,依据[全局变量](../parameter/global.md)
 - 描述信息:描述该节点的功能。
 - 任务优先级:worker线程数不足时,根据优先级从高到低依次执行,优先级一样时根据先进先出原则执行。
 - Worker分组:任务分配给worker组的机器机执行,选择Default,会随机选择一台worker机执行。
+- 环境名称:安全中心中配置的环境,不配置则不使用。
+- 任务组名称:资源中心中配置的任务组,不配置则不使用。
 - 失败重试次数:任务失败重新提交的次数,支持下拉和手填。
 - 失败重试间隔:任务失败重新提交任务的时间间隔,支持下拉和手填。
-- 超时告警:勾选超时告警、超时失败,当任务超过"超时时长"后,会发送告警邮件并且任务执行失败.
-- 条件:可以为switch任务配置多个条件,当条件满足时,就会执行指定的分支,可以配置多个不同的条件来满足不同的业务
-- 分支流转:默认的流转内容,当**条件**中的内容为全部不符合要求时,则运行**分支流转**中指定的分支
+- 延时执行时间:任务延迟执行的时间。
+- 超时告警:勾选超时告警、超时失败,当任务超过"超时时长"后,会发送告警邮件并且任务执行失败。
+- 条件:可以为switch任务配置多个条件,当条件满足时,就会执行指定的分支,可以配置多个不同的条件来满足不同的业务,使用字符串判断时需要使用""。
+- 分支流转:默认的流转内容,当**条件**中的内容为全部不符合要求时,则运行**分支流转**中指定的分支。
 
 ## 详细流程
+这里使用1个 switch 任务以及3个 shell 任务来演示。
 
-假设我们三个任务,其依赖关系是 `A -> B -> [C, D]` 其中task_a是shell任务,task_b是switch任务
+### 1、创建工作流

Review Comment:
   ```suggestion
   ### 1、创建工作流
   
   ```
   It is recommended to add a line break between the title and body statement. 
The format will be more standardized. The same as following.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to