728x90
반응형
목적
say_hello1 > say_hello2 > say_hello3 함수를 차례대로 실행시켜보자.
say_hello1.py
def say_hello1():
print("Hello from say_hello1!")
say_hello2.py
def say_hello2():
print("Hello from say_hello2!")
say_hello1.py
def say_hello3():
print("Hello from say_hello3!")
hello_airflow_test.py
from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime
from say_hello1 import say_hello1
from say_hello2 import say_hello2
from say_hello3 import say_hello3
with DAG(
dag_id='hello_airflow_test',
start_date=datetime(2024, 1, 1),
schedule_interval='@once',
catchup=False,
tags=['test']
) as dag:
task1 = PythonOperator(
task_id='say_hello_task1',
python_callable=say_hello1
)
task2 = PythonOperator(
task_id='say_hello_task2',
python_callable=say_hello2
)
task3 = PythonOperator(
task_id='say_hello_task3',
python_callable=say_hello3
)
task1 >> task2 >> task3 # 순차 실행
728x90
반응형
'개발중 > AirFlow' 카테고리의 다른 글
Airflow DAG에서 모듈 임포트가 안 될 때: 상대경로 vs 절대경로 해결 (0) | 2025.04.07 |
---|---|
[Airflow] Airflow 병렬 처리의 함정: Worker 분산 없이 처리하면? (0) | 2024.10.10 |
[AirFlow] 특정 Role 만 특정 Dag 권한주고 싶다. (0) | 2024.10.08 |
[AirFlow] airflow 사용자 생성 / REST API (0) | 2024.10.08 |
[Airflow] example_datasets.py 에러 (1) | 2024.10.08 |
댓글