@ -4,15 +4,8 @@ Condition is a conditional node, that determines which downstream task should ru
## Create Task
## Create Task
Drag from the toolbar <imgsrc="/img/conditions.png"width="20"/> task node to canvas to create a new Conditions task, as shown in the figure below:
- Click `Project -> Management-Project -> Name-Workflow Definition`, and click the "Create Workflow" button to enter the DAG editing page.
- Drag from the toolbar <imgsrc="/img/conditions.png"width="20"/> task node to canvas.
<palign="center">
<imgsrc="/img/condition_dag_en.png"width="80%"/>
</p>
<palign="center">
<imgsrc="/img/condition_task_en.png"width="80%"/>
</p>
## Parameter
## Parameter
@ -24,7 +17,7 @@ Drag from the toolbar <img src="/img/conditions.png" width="20"/> task node to c
- 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.
- 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.
- 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.
- 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.
- 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.
- Downstream tasks selection: supports two branches success and failure.
- Downstream tasks selection: Depending on the status of the predecessor task, you can jump to the corresponding branch, currently two branches are supported: success, failure
- Success: When the upstream task runs successfully, run the success branch.
- Success: When the upstream task runs successfully, run the success branch.
- Failure: When the upstream task runs failed, run the failure branch.
- Failure: When the upstream task runs failed, run the failure branch.
- Upstream condition selection: can select one or more upstream tasks for conditions.
- Upstream condition selection: can select one or more upstream tasks for conditions.
@ -34,3 +27,34 @@ Drag from the toolbar <img src="/img/conditions.png" width="20"/> task node to c
## Related Task
## Related Task
[switch](switch.md): Conditions task mainly executes the corresponding branch based on the execution status (success, failure) of the upstream nodes. The [Switch](switch.md) task node mainly executes the corresponding branch based on the value of the [global parameter](../parameter/global.md) and the result of user written expression.
[switch](switch.md): Conditions task mainly executes the corresponding branch based on the execution status (success, failure) of the upstream nodes. The [Switch](switch.md) task node mainly executes the corresponding branch based on the value of the [global parameter](../parameter/global.md) and the result of user written expression.
## Example
This sample demonstrates the operation of the Condition task by using the [Shell](shell.md) task.
### 1. Create workflow
Go to the workflow definition page, and then create the following task nodes:
- Node_A: Shell task, prints out "hello world", its main function is the upstream branch of Condition, and triggers the corresponding branch node according to whether its execution is successful or not.
- Condition: The Conditions task executes the corresponding branch according to the execution status of the upstream task.
- Node_Success: Shell task, print out "success", Node_A executes the successful branch.
- Node_False: Shell task, print out "false", Node_A executes the failed branch.
After you finish creating the workflow, you can run the workflow online. You can view the execution status of each task on the workflow instance page. As shown below:
In the above figure, the task status marked with a green check mark is the successfully executed task node.
## Notice
- The Conditions task supports multiple upstream tasks, but only two downstream tasks.
- The Conditions task and the workflow that contain it do not support copy operations.
- The predecessor task of Conditions cannot connect to its branch nodes, which will cause logical confusion and does not conform to DAG scheduling. The situation shown below is **wrong**.