-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_11_sub_dag.py
More file actions
43 lines (31 loc) · 1.16 KB
/
_11_sub_dag.py
File metadata and controls
43 lines (31 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from airflow import DAG
from airflow.operators.dummy import DummyOperator
from airflow.operators.python import PythonOperator
def a():
print('a')
def b():
print('b')
def c():
print('c')
def subdag_(parent_dag_id, subdag_id, default_args):
with DAG(
f"{parent_dag_id}.{subdag_id}",
default_args=default_args,
schedule=None
) as dag:
start = DummyOperator(task_id='start')
training_a = PythonOperator(
task_id='training_a',
python_callable=a
)
training_b = PythonOperator(
task_id='training_b',
python_callable=b
)
training_c = PythonOperator(
task_id='training_c',
python_callable=c
)
end = DummyOperator(task_id='end', trigger_rule='all_done')
start >> [training_a,training_b,training_c] >> end
return dag