ワークフロースケジューリングフレームワーク

データエンジニアリング入門

Vincent Vankrunkelsven

Data Engineer, DataCamp

パイプラインの例

 

Spark を使って csv からデータを抽出するシンプルなパイプラインの例

スケジュールする方法は?

  • 手動で
  • cron スケジューリングツール
  • 依存関係はどう扱う?
データエンジニアリング入門

DAG

有向非巡回グラフ(DAG)

  • ノードの集合
  • 有向エッジ
  • 巡回なし

DAG の例

データエンジニアリング入門

作業に適したツール

 

  • Linux の cron
  • Prefect と Dagster
  • Apache Airflow
データエンジニアリング入門

Apache Airflow のロゴ

  • Airbnb で開発
  • DAG
  • Python
データエンジニアリング入門

Airflow: DAG の例

 

Airflow の DAG の例

データエンジニアリング入門

Airflow: コードでの例

@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(): ...
データエンジニアリング入門

Airflow: コードでの例

@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()
データエンジニアリング入門

練習しましょう!

データエンジニアリング入門

Preparing Video For Download...