Cadres de planification de workflows

Introduction au data engineering

Vincent Vankrunkelsven

Data Engineer, DataCamp

Un exemple de pipeline

 

Exemple de pipeline simple qui extrait depuis un CSV avec Spark

Comment planifier ?

  • Manuellement
  • Outil de planification cron
  • Et les dépendances ?
Introduction au data engineering

DAG

Graphe orienté acyclique

  • Ensemble de nœuds
  • Arêtes orientées
  • Pas de cycles

Exemple de DAG

Introduction au data engineering

Les bons outils

 

  • cron sous Linux
  • Prefect et Dagster
  • Apache Airflow
Introduction au data engineering

Logo d'Apache Airflow

  • Créé chez Airbnb
  • DAG
  • Python
Introduction au data engineering

Airflow : exemple de DAG

 

Exemple de DAG Airflow

Introduction au data engineering

Airflow : un exemple en code

@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 au data engineering

Airflow : un exemple en code

@dag(dag_id="example_dag", ...)
def example_dag():
    ...
    # Définir le flux de dépendances
    cluster = start_cluster()
    customers = ingest_customer_data()
    products = ingest_product_data()
    cluster >> [customers, products]
    [customers, products] >> enrich_customer_data()
# Exécuter le DAG
example_dag()
Introduction au data engineering

Passons à la pratique !

Introduction au data engineering

Preparing Video For Download...