docs/docs/en/guide/task/conditions.md
Condition is a conditional node, that determines which downstream task should run based on the condition of the upstream task. Currently, the Conditions support multiple upstream tasks, but only two downstream tasks. When the number of upstream tasks exceeds one, achieve complex upstream dependencies by through and and or operators.
Project Management -> Project Name -> Workflow Definition, and click the Create Workflow button to enter the DAG editing page.Default Task Parameters section for default parameters.| Parameter | Description |
|---|---|
| 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 <ul><li>Success: When the upstream task runs successfully, run the success branch.</li><li>Failure: When the upstream task runs failed, run the failure branch.</li></ul></li></ul> |
| Upstream condition selection | Can select one or more upstream tasks for conditions.<ul><li>Add an upstream dependency: the first parameter is to choose a specified task name, and the second parameter is to choose the upstream task status to trigger conditions.</li><li>Select upstream task relationship: use and and or operators to handle the complex relationship of upstream when there are multiple upstream tasks for conditions.</li></ul></li></ul> |
switch: Conditions task mainly executes the corresponding branch based on the execution status (success, failure) of the upstream nodes. The Switch task node mainly executes the corresponding branch based on the value of the global parameter and the result of user written expression.
This sample demonstrates the operation of the Condition task by using the Shell task.
Go to the workflow definition page, and then create the following task nodes:
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.