Airflow DummyOperator
Dummy Operator
μμ/λ/κ·Έλ£Ήν μ μ¬μ©νλ€.
μμ‘΄μ μΈ μ¬λ¬ TASKλ€μ ꡬμ±νλ κ²½μ°μ μ μ©νλ€.
1
from airflow.operators.dummy import DummyOperator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2023, 10, 23),
'email_on_failure': False,
'email_on_retry': False,
'retries': 1
}
dag = DAG('dummy operator test', default_args=default_args, schedule_interval='@daily')
start_task = DummyOperator(task_id='start_task', dag=dag)
task_1 = DummyOperator(task_id='task_1', dag=dag)
task_2 = DummyOperator(task_id='task_2', dag=dag)
end_task = DummyOperator(task_id='end_task', dag=dag)
start_task >> task_1 >> task_2 >> end_task
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from airflow.utils.task_group import TaskGroup
dag = DAG('dummy_operator_example', default_args=default_args, schedule_interval='@daily')
start_task = DummyOperator(task_id='start_task', dag=dag)
with TaskGroup(group_id="taskgroup", tooltip="Task group test") as group:
task_1 = DummyOperator(task_id='task_1', dag=dag)
task_2 = DummyOperator(task_id='task_2', dag=dag)
task_3 = DummyOperator(task_id='task_2', dag=dag)
task1 >> [task2, task3]
end_task = DummyOperator(task_id='end_task', dag=dag)
start_task >> taskgroup >> end_task
μ°Έμ‘°
- https://medium.com/@agusmahari/getting-started-with-the-dummyoperator-in-airflow-simplifying-workflow-design-cd68048ff211