x89
x89

Reputation: 3460

Run multiple tasks in parallel

I know it is possible to run 1 set of tasks in parallel. For example, something like this:

begin >> [A, B, C, D,E] >> end

would run A, B, C, D, E all in parallel. However, I want to do something like this such that after begin, there are two workflows running in parallel. Something like:

            A -> B -> C 
begin ->                    ->  end
            D -> E -> F

What would be the correct syntax to achieve this?

Upvotes: 0

Views: 2477

Answers (1)

ozs
ozs

Reputation: 3651

Every split is like a starting point.

start_dag = start_task()
end_dag = end_task()

a = DummyOperator(task_id="a")
b = DummyOperator(task_id="b")
c = DummyOperator(task_id="c")
d = DummyOperator(task_id="d")
e = DummyOperator(task_id="e")
f = DummyOperator(task_id="f")

(start_dag >> [a, d])
(a >> b >> c >> end_dag)
(d >> e >> f >> end_dag)

enter image description here

Upvotes: 1

Related Questions