Airflow Xcom Exclusive [portable] | Editor's Choice
Your (MWAA, Composer, Astronomer, or self-hosted)
Suppose we have a workflow that involves processing customer data. We can use XCom to share data between tasks, enabling data-driven decision-making.
Airflow keeps XCom data forever by default. Over months of operation, old XCom data can clog up your database. Exclusive pipeline designs include a cleanup task at the end of the DAG. This task deletes XCom rows for that specific run once the pipeline completes successfully. 3. Explicit Cloud Paths airflow xcom exclusive
# Pushing data manually def push_custom_data(**kwargs): ti = kwargs['ti'] # Get the Task Instance ti.xcom_push(key='model_accuracy', value=0.94) # Pulling data manually def pull_custom_data(**kwargs): ti = kwargs['ti'] accuracy = ti.xcom_pull(key='model_accuracy', task_ids='push_custom_data_task') print(f"The model accuracy is accuracy") Use code with caution. The Hidden Trap: Why Big Data Breaks XCom
In the world of workflow orchestration, Apache Airflow tasks are designed to be atomic, isolated units of work. While this design ensures reliability—if one task fails, it doesn't immediately crash the whole DAG—it creates a challenge: Enter Airflow XComs (cross-communications). Your (MWAA, Composer, Astronomer, or self-hosted) Suppose we
The default behavior of xcom_pull() when no task_ids is specified changed between Airflow 2.10.2 and 3.0.2. Always explicitly specify task_ids to make your DAGs resilient to version upgrades.
The official Airflow source code notes that certain XCom function arguments are "mutually exclusive". For example, when pushing an XCom, the execution_date and run_id parameters cannot both be provided—they are mutually exclusive. Similarly, some retrieval methods expect either a task_id or a dag_id , but not both under certain conditions. Understanding these nuances can save hours of debugging. Over months of operation, old XCom data can
To save storage costs and improve transfer speeds, you can enable compression for the data stored in your object store.