GlenboLake commented on issue #51821:
URL: https://github.com/apache/airflow/issues/51821#issuecomment-3715193906
This is still broken in Airflow 3.1.3. In my use case, we have a common
function that may be used in multiple DAGs, so the upstream task_id is not
necessarily known. A simplified example:
```python
def set_xcom(ti, value):
ti.xcom_push(key="my_xcom", value=value)
def print_xcom(ti):
logging.info(ti.xcom_pull(key="my_xcom"))
with DAG(dag_id="dag_1") as dag_1:
write = PythonOperator(task_id="dag1_task1", value="a",
python_callable=set_xcom)
read = PythonOperator(task_id="print", python_callable=print_xcom)
with DAG(dag_id="dag_2") as dag_2:
write = PythonOperator(task_id="dag2_task1", value="b",
python_callable=set_xcom)
read = PythonOperator(task_id="print", python_callable=print_xcom)
```
The `print_xcom` function cannot be modified to satisfy both dag_1 and dag_2
under Airflow 3.1.3.
Please reopen this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]