Ramverk för arbetsflödesschemaläggning

Introduktion till datatekniker

Vincent Vankrunkelsven

Data Engineer, DataCamp

Ett exempel på en pipeline

 

Exempel på enkel pipeline som extraherar från csv med Spark

Hur schemaläggs det?

  • Manuellt
  • Schemaläggningsverktyget cron
  • Vad gäller beroenden?
Introduktion till datatekniker

DAG:er

Directed Acyclic Graph

  • Uppsättning noder
  • Riktade kanter
  • Inga cykler

Exempel på DAG

Introduktion till datatekniker

Verktygen för jobbet

 

  • Linux cron
  • Prefect och Dagster
  • Apache Airflow
Introduktion till datatekniker

Logotyp för Apache Airflow

  • Skapat av Airbnb
  • DAG:er
  • Python
Introduktion till datatekniker

Airflow: ett exempel på en DAG

 

Exempel på Airflow-DAG

Introduktion till datatekniker

Airflow: ett exempel i kod

@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(): ...
Introduktion till datatekniker

Airflow: ett exempel i kod

@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()
Introduktion till datatekniker

Nu kör vi en övning!

Introduktion till datatekniker

Preparing Video For Download...