Frameworky pro plánování workflow

Introduction to Data Engineering

Vincent Vankrunkelsven

Data Engineer, DataCamp

Příklad pipeline

 

Příklad jednoduchého pipeline extrahujícího data z csv pomocí Spark

Jak plánovat?

  • Manuálně
  • Nástroj cron
  • Co se závislostmi?
Introduction to Data Engineering

DAGy

Acyklický orientovaný graf

  • Množina uzlů
  • Orientované hrany
  • Žádné cykly

Příklad DAG

Introduction to Data Engineering

Nástroje pro tento úkol

 

  • cron v Linuxu
  • Prefect a Dagster
  • Apache Airflow
Introduction to Data Engineering

Logo Apache Airflow

  • Vytvořeno v Airbnb
  • DAGy
  • Python
Introduction to Data Engineering

Airflow: příklad DAG

 

Příklad DAG v Airflow

Introduction to Data Engineering

Airflow: příklad v kódu

@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(): ...
Introduction to Data Engineering

Airflow: příklad v kódu

@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()
Introduction to Data Engineering

Pojďme cvičit!

Introduction to Data Engineering

Preparing Video For Download...