with DAG(dag_id='xcom_demo', start_date=datetime(2024,1,1), schedule_interval=None) as dag:
push >> pull
Received: Hello from Task 1 3. Return Values as Implicit XComs If a Python callable returns a value, Airflow automatically pushes it under the key return_value . xcom airflow
push = PythonOperator(task_id='push_task', python_callable=push_function) pull = PythonOperator(task_id='pull_task', python_callable=pull_function) schedule_interval=None) as dag: push >
def pull_function(**context): value = context['ti'].xcom_pull(key='message', task_ids='push_task') print(f"Received: value") task_ids='push_task') print(f"Received: value")