GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing dolphinscheduler.apache.org — Condition — apache-dolphinscheduler 4.1.0-dev documentation ConditionA condition task type’s example and dive into information of PyDolphinScheduler. Exampler""" A example workflow for task condition. This example will create five task in single workflow, with four shell task and one condition task. Task condition have one upstream which we declare explicit with syntax `parent >> condition`, and three downstream automatically set dependence by condition task by passing parameter `condition`. The graph of this workflow like: pre_task_1 -> -> success_branch \ / pre_task_2 -> -> conditions -> / \ pre_task_3 -> -> fail_branch . """ from pydolphinscheduler.core.workflow import Workflow from pydolphinscheduler.tasks.condition import FAILURE, SUCCESS, And, Condition from pydolphinscheduler.tasks.shell import Shell with Workflow(name="task_condition_example") as workflow: pre_task_1 = Shell(name="pre_task_1", command="echo pre_task_1") pre_task_2 = Shell(name="pre_task_2", command="echo pre_task_2") pre_task_3 = Shell(name="pre_task_3", command="echo pre_task_3") cond_operator = And( And( SUCCESS(pre_task_1, pre_task_2), FAILURE(pre_task_3), ), ) success_branch = Shell(name="success_branch", command="echo success_branch") fail_branch = Shell(name="fail_branch", command="echo fail_branch") condition = Condition( name="condition", condition=cond_operator, success_task=success_branch, failed_task=fail_branch, ) workflow.submit() Dive IntoTask Conditions.
YAML file example# Define the workflow workflow: name: "Condition" # Define the tasks within the workflow tasks: - { "task_type": "Shell", "name": "pre_task_1", "command": "echo pre_task_1" } - { "task_type": "Shell", "name": "pre_task_2", "command": "echo pre_task_2" } - { "task_type": "Shell", "name": "pre_task_3", "command": "echo pre_task_3" } - { "task_type": "Shell", "name": "success_branch", "command": "echo success_branch" } - { "task_type": "Shell", "name": "fail_branch", "command": "echo fail_branch" } - name: condition task_type: Condition success_task: success_branch failed_task: fail_branch op: AND groups: - op: AND groups: - task: pre_task_1 flag: true - task: pre_task_2 flag: true - task: pre_task_3 flag: false |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |