워크플로 스케줄링 프레임워크

데이터 엔지니어링 입문

Vincent Vankrunkelsven

Data Engineer, DataCamp

파이프라인 예시

 

Spark로 CSV에서 데이터를 추출하는 간단한 파이프라인 예시

어떻게 스케줄링할까요?

  • 수동으로
  • cron 스케줄링 도구
  • 의존성 처리는 어떻게 할까요?
데이터 엔지니어링 입문

DAG

방향성 비순환 그래프(Directed Acyclic Graph)

  • 노드 집합
  • 방향이 있는 엣지
  • 순환 없음

DAG 예시

데이터 엔지니어링 입문

작업에 필요한 도구

 

  • Linux의 cron
  • Prefect와 Dagster
  • Apache Airflow
데이터 엔지니어링 입문

Apache Airflow 로고

  • Airbnb에서 개발
  • DAG
  • Python
데이터 엔지니어링 입문

Airflow: DAG 예시

 

Airflow DAG 예시

데이터 엔지니어링 입문

Airflow: 코드로 보는 예시

@dag(dag_id="example_dag",
     start_date=datetime(2024, 1, 1),
     schedule="0 * * * *")
def example_dag():

@task def start_cluster(): ... @task def ingest_customer_data(): ... @task def ingest_product_data(): ... @task def enrich_customer_data(): ...
데이터 엔지니어링 입문

Airflow: 코드로 보는 예시

@dag(dag_id="example_dag", ...)
def example_dag():
    ...
    # Set up dependency flow
    cluster = start_cluster()
    customers = ingest_customer_data()
    products = ingest_product_data()
    cluster >> [customers, products]
    [customers, products] >> enrich_customer_data()
# Run the DAG
example_dag()
데이터 엔지니어링 입문

연습해 봅시다!

데이터 엔지니어링 입문

Preparing Video For Download...