Framework-uri pentru planificarea fluxurilor de lucru

Introducere în Data Engineering

Vincent Vankrunkelsven

Data Engineer, DataCamp

Un exemplu de pipeline

 

Exemplu de pipeline simplu care extrage dintr-un csv folosind Spark

Cum planificăm execuția?

  • Manual
  • Instrumentul de planificare cron
  • Dar dependențele?
Introducere în Data Engineering

DAG-uri

Graf Direcționat Aciclic

  • Set de noduri
  • Muchii direcționate
  • Fără cicluri

Exemplu de DAG

Introducere în Data Engineering

Instrumentele potrivite

 

  • cron din Linux
  • Prefect și Dagster
  • Apache Airflow
Introducere în Data Engineering

Logo Apache Airflow

  • Creat la Airbnb
  • DAG-uri
  • Python
Introducere în Data Engineering

Airflow: un exemplu de DAG

 

Exemplu de DAG Airflow

Introducere în Data Engineering

Airflow: un exemplu de cod

@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(): ...
Introducere în Data Engineering

Airflow: un exemplu de cod

@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()
Introducere în Data Engineering

Hai să exersăm!

Introducere în Data Engineering

Preparing Video For Download...