All Products
Search
Document Center

Data Management:Configure a conditional branch node

Last Updated:Nov 26, 2024

To make a conditional judgment in a task flow, you can add a conditional branch node to the task flow. The subsequent tasks in the task flow can be run only if the conditional branch node meets multiple specified conditions. This topic describes how to configure a conditional branch node.

Scenarios

During the execution of a task flow, if the conditional expression of a conditional branch node evaluates to true, the subsequent tasks are executed. Otherwise, the subsequent tasks are not executed. You can apply a conditional branch node to the following or other similar scenarios:

  • Back up and delete data when the number of data entries reaches a specified value.

  • Send a notification when the sales amount meets a specified condition.

  • Check whether a specific file exists. If the file does not exist, create it.

Usage notes

A conditional branch node cannot independently exist in a task flow. You must connect the node to a node that performs data integration, data processing, or status check. This way, the configurations of the conditional branch node take effect.

Procedure

  1. Log on to the DMS console V5.0.
  2. In the top navigation bar, choose Data Development > Data Development > Task Orchestration.

    Note

    If you use the DMS console in simple mode, move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner and choose All Features > Data Development > Data Development > Task Orchestration.

  3. Click the name of a task flow that you want to manage to go to the details page of the task flow.

    Note

    For more information about how to create a task flow, see Overview.

  4. In the Task Type list on the left side of the canvas, drag the Conditional Branch node to the blank area on the canvas.

  5. Double-click the Conditional Branch node.

  6. On the configuration tab of the conditional branch node, configure one or more conditional expressions.

    • Select an upstream variable or a state from the Variable Name drop-down list.

      Note
      • You can click the Variable Setting tab in the right-side navigation pane to view the upstream variables and task states on the Input Variables tab.

      • If you select a state from the Variable Name drop-down list, you do not need to set the Relational Operator or Variable Value parameter.

    • Select a comparison operator from the Relational Operator drop-down list.

    • Enter the expected variable value or variable in the Variable Value field.

      The variable must be in the ${var_name} format. You can enter the following types of variables:

      • Upstream variables: Upstream variables are output variables from upstream nodes. You can click the Variable Setting tab in the right-side navigation pane to view the upstream variables on the Input Variables tab.

      • System variables: You can click the Variable Setting tab in the right-side navigation pane to view the system variables on the Input Variables tab. For more information about the system variables, see System variables.

      • Time variables: Use the default time variables or task flow variables. For more information about how to configure task flow variables, see Configure time variables.

    • Optional: Click an icon to the right of a conditional expression to create or delete an expression.

      • 加: Create a conditional expression at the same level as the original expression and select a logical operator from the logical operator drop-down list to use between the new expression and the original expression.

      • 5加4: Create a conditional expression and move it to the next level together with the original expression. Select a logical operator from the logical operator drop-down list to use between the new expression and the original expression.

      • 减: Delete a conditional expression.

      9任务编排条件表达式2

    Note
    • You can create up to three levels of conditional expressions.

    • You can view the judgment logic of the conditional expressions in the Preview section to the right of the Conditional Expression section.

    • When you configure an expression for a conditional branch node, you can use the output variables specified for an SQL assignment node and an Elastic Compute Service (ECS) remote commands node. For more information, see Configure an SQL assignment node and Configure an ECS remote commands node.

Examples

Configure conditional branch nodes in the AND relationship

If the conditional branch nodes of a task flow are in the AND relationship, DMS marks the entire task flow as failed regardless of whether other nodes are successfully executed when a node is not executed.

Configure conditional branches in the OR relationship

If the conditional branch nodes of a task flow are in the OR relationship, DMS marks the entire task flow as successful regardless of whether other nodes are successfully executed when a node in the task flow is successfully executed.

If you configure a conditional expression that specifies the forcible execution success for a conditional branch node in a task flow, such as the whether to successfully run a conditional branch node = true expression for conditional branch node 3, DMS marks the entire task flow as successful when a branch node is successfully executed.

Related operations

When you configure a conditional branch node, you can use output variables specified for an SQL assignment node or an ECS remote commands node. For more information, see Configure an SQL assignment node and Configure an ECS remote commands node.