Kimuksung
Kimuksung μ•ˆλ…•ν•˜μ„Έμš”. λΆ„μ‚°μ²˜λ¦¬μ— 관심이 λ§Žμ€ μƒκ°ν•˜λŠ” μ£Όλ‹ˆμ–΄ Data Enginnerμž…λ‹ˆλ‹€.

Airflow DummyOperator

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