apache / apache/airflow

The post_execute(context, result) the Result is None

Open
#57,224 1 comment 0 reactions 1 assignee Claimed by @rawwar View on GitHub
affected_version:3.0 area:core kind:bug priority:upgrade_to_airflow3
Dominant language
Python
Stars
46.9k
Forks
17.8k
Avg merge
2d 10h
Merged PRs (30d)
483

Description

### Apache Airflow version

Other Airflow 2/3 version (please specify below)

### If "Other Airflow 2/3 version" selected, which one?

3.0.6

### What happened?

As the Airflow customer, we want to override the post_execute() function from BaseOperator.
We are using the KubernetesPodOperator, to run some bash code. The bash code writes the xcom JSON file into /airflow/xcom/return.json. And already set do_xcom_push: True

Everything works good in Airflow 2.10.4, but after we upgrade to Airflow 3.0.6. There is some issue
post_execute(context: Any, result: Any)

The result is None, but we can see the JSON value in the Airflow UI -> Xcom.
The context in the post_execute(), the taskInstance satus still be RUNNING

### What you think should happen instead?

As the Airflow Behaviour in 2.10.4, when the airflow call post_execute(context: Any, result: Any) it will provide the XCOM json from /airflow/xcom/return.json

But it is None in Airflow 3.0.6

### How to reproduce

1. Define the task based on KubernetesPodOperator
2. do_push_xcom: True
3. In the KubernetesPodOperator, cmds to echo the JSON file to /airflow/xcom/return.json
4. Define the function for post_execute(context: Any, result: Any)

Check the result value and task instance status in post_execute() function

### Operating System

Openshift with Redhat

### Versions of Apache Airflow Providers

apache-airflow==3.0.6

### Deployment

Other Docker-based deployment

### 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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.