C.W.K.
Stream
Lesson 02 of 05 · published

Apache Airflow — DAG, Operator, Scheduler

~14 min · airflow, orchestration

Level 0구경꾼
0 XP0/47 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

많은 production 팀의 default

Apache Airflow (2026.4 기준 2.10) 는 세계에서 가장 많이 배포된 orchestrator. 2014 년 Airbnb 에서 시작, 2019 년 Apache top-level project, Lyft, Stripe, Netflix, Spotify, 그리고 들어본 모든 "data platform team" 의 production 파이프라인 운영. 모델은 task 의 DAG — Directed Acyclic Graph.

3가지 architectural piece

  • Webserver / UI — DAG, run, task instance, log 보기.
  • Scheduler — DAG 정의 읽고, 뭐 돌릴지 결정, task queue 에.
  • Worker / executor — 실제 task 실행. 한 머신엔 local executor; cluster 엔 Celery 또는 Kubernetes.

메타데이터 DB 도 필요 (production 에선 Postgres). Dagster 와 Prefect 가 깎아내리는 마찰이 이거 — Airflow 가 경쟁자보다 배포 부품 많지만, 성숙한 ecosystem (1,500+ provider operator, 거대 커뮤니티) 이 많은 팀에 그 값어치 함.

Code

Modern @task decorator API 의 Airflow DAG·python
from datetime import datetime, timedelta
from airflow.decorators import dag, task

@dag(
    dag_id='orders_pipeline',
    schedule='0 3 * * *',
    start_date=datetime(2026, 4, 1),
    catchup=False,
    default_args={'retries': 3, 'retry_delay': timedelta(minutes=5)},
    tags=['orders', 'analytics'],
)
def orders_pipeline():

    @task
    def extract(ds: str) -> str:
        # ds 가 logical date YYYY-MM-DD
        path = f'raw/orders/{ds}.json'
        # ... 실제 fetch + write ...
        return path

    @task
    def transform(raw_path: str, ds: str) -> str:
        out_path = f'warehouse/orders/date={ds}/'
        # ... raw_path 읽고, transform, out_path 에 Parquet ...
        return out_path

    @task
    def validate(parquet_path: str) -> None:
        # ... pandera schema 검증 ...
        return None

    raw = extract('{{ ds }}')
    out = transform(raw, '{{ ds }}')
    validate(out)

orders_pipeline()

External links

Exercise

Docker 가능하면 Astronomer CLI 로 astro dev start 해서 local Airflow 띄워. 토이 데이터셋용 3-task DAG (extract → transform → validate) 작성. UI 에서 trigger, task instance 도는 거 보고, 실패 click 해서 로그 보기. 목표는 loop 느끼는 거 — Airflow 의 가치 대부분이 scheduler 아니라 visibility.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.