ワークフローのスケジューリング基盤

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

Vincent Vankrunkelsven

Data Engineer @ DataCamp

パイプライン例

 

Spark で CSV から抽出するシンプルなパイプライン例

どうスケジュールするか?

  • 手動
  • cron スケジューラ
  • 依存関係は?
データエンジニアリング入門

DAG

有向非巡回グラフ(DAG)

  • ノード集合
  • 有向エッジ
  • サイクルなし

DAG の例

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

主なツール

 

  • Linux の cron
  • Spotify の Luigi
  • Apache Airflow
データエンジニアリング入門

Apache Airflow のロゴ

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

Airflow:DAG の例

 

Airflow DAG の例

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

Airflow:コードで見る例

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

Let's practice!

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

Preparing Video For Download...