Frameworks voor workflowplanning

Introductie tot Data Engineering

Vincent Vankrunkelsven

Data Engineer @ DataCamp

Een voorbeeldpipeline

 

Eenvoudige pipeline die uit csv extraheert met Spark

Hoe plannen?

  • Handmatig
  • cron-planningstool
  • En afhankelijkheden?
Introductie tot Data Engineering

DAG's

Gerichte acyclische graaf

  • Set knooppunten
  • Gerichte randen
  • Geen cycli

Voorbeeld-DAG

Introductie tot Data Engineering

Tools voor de klus

 

  • Linux’ cron
  • Spotify’s Luigi
  • Apache Airflow
Introductie tot Data Engineering

Logo van Apache Airflow

  • Ontwikkeld bij Airbnb
  • DAG's
  • Python
Introductie tot Data Engineering

Airflow: een voorbeeld-DAG

 

Voorbeeld Airflow-DAG

Introductie tot Data Engineering

Airflow: een codevoorbeeld

# Create the DAG object
dag = DAG(dag_id="example_dag", ..., schedule_interval="0 * * * *")

# Define operations start_cluster = StartClusterOperator(task_id="start_cluster", dag=dag) ingest_customer_data = SparkJobOperator(task_id="ingest_customer_data", dag=dag) ingest_product_data = SparkJobOperator(task_id="ingest_product_data", dag=dag) enrich_customer_data = PythonOperator(task_id="enrich_customer_data", ..., dag = dag)
# Set up dependency flow start_cluster.set_downstream(ingest_customer_data) ingest_customer_data.set_downstream(enrich_customer_data) ingest_product_data.set_downstream(enrich_customer_data)
Introductie tot Data Engineering

Laten we oefenen!

Introductie tot Data Engineering

Preparing Video For Download...