Airflow Part 4 - Task Context & Jinja Templating

Data Engineering
MLOps
Airflow
Author

Imad Dabbura

Published

February 7, 2022

Note

Other than my experience and the documentation, the main resource behind this post and figures is the fantastic book: Data Pipelines with Apache. Airflow.

import airflow
from airflow import DAG
from airflow.operators.python import PythonOperator

dag = DAG(dag_id="python-operator-context", start_date=airflow.utils.dates.days_ago(1))


def _print_context(**kwargs):
    print(kwargs)
print_context = PythonOperator(task_id="print-context", python_callable=_print_context, dag=dag)
print_context