Switch
Drag the in the tool bar to create task. Note After the switch task is created, you must configure it downstream to make parameter work.
- Node name: The node name in a workflow definition is unique.
- Descriptive information: describe the function of the node.
- Task priority: When the number of worker threads is insufficient, they are executed in order from high to low, and when the priority is the same, they are executed according to the first-in first-out principle.
- Worker grouping: Tasks are assigned to the machines of the worker group to execute. If Default is selected, a worker machine will be randomly selected for execution.
- Number of failed retry attempts: The number of times the task failed to be resubmitted. It supports drop-down and hand-filling.
- Failed retry interval: The time interval for resubmitting the task after a failed task. It supports drop-down and hand-filling.
- condition: You can configure multiple conditions for the switch task. When the conditions are true, the configured branch will be executed. You can configure multiple different conditions to satisfy different businesses.
- Branch flow: The default branch flow, when all the conditions are false, it will execute this branch flow.
- In task A, a global variable named is defined through global variable, and the declaration method is
${setValue(id=1)}
- Task B adds conditions and uses global variables declared upstream to achieve conditional judgment (note that global variables must exist when the switch is running, which means that switch task can use global variables that are not directly upstream). We want workflow execute task C when id = 1 else run task D
- Configure task C to run when the global variable . Then edit
${id} == 1
in the condition of task B, select as branch flow
- Configure task C to run when the global variable . Then edit
Switch task configuration is as follows
:Conditiontask mainly executes the corresponding branch based on the execution status (success, failure) of the upstream node. The task mainly executes the corresponding branch based on the value of the global parameter and the judgment expression result written by the user.