ReadytoRocc opened a new issue, #22931:
URL: https://github.com/apache/airflow/issues/22931
### Apache Airflow version
2.2.5 (latest released)
### What happened
A task's XCom value is cleared when a task is rescheduled after being
deferred.
### What you think should happen instead
XCom should not be cleared in this case, as it is still the same task run.
### How to reproduce
```
from datetime import datetime, timedelta
from airflow import DAG
from airflow.models import BaseOperator
from airflow.triggers.temporal import TimeDeltaTrigger
class XComPushDeferOperator(BaseOperator):
def execute(self, context):
context["ti"].xcom_push("test", "test_value")
self.defer(
trigger=TimeDeltaTrigger(delta=timedelta(seconds=10)),
method_name="next",
)
def next(self, context, event=None):
pass
with DAG(
"xcom_clear", schedule_interval=None, start_date=datetime(2022, 4, 11),
) as dag:
XComPushDeferOperator(task_id="xcom_push")
```
### Operating System
macOS
### Versions of Apache Airflow Providers
_No response_
### Deployment
Astronomer
### Deployment details
_No response_
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]