GitHub user deepak4babu created a discussion: Task context environment 
variables are not set in callbacks running in dag processor

### Apache Airflow version

Other Airflow 2/3 version (please specify below)

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

2.10.3

### What happened?

Task context environment variables are not set in callbacks running in dag 
processor.

We use the dag_id from AIRFLOW_CTX_DAG_ID environment variable to create some 
connections in our internal packages. 



### What you think should happen instead?

The task context environment variables should be set in callbacks run in dag 
processor especially on_failure_callbacks

### How to reproduce

Create a dag with on failure callback set for a task. In the callback function, 
get the environment variables and save it to a file (as logging is not 
available for callbacks). The env list will not have AIRFLOW_CTX_* keys.

### Operating System

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" 
VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian 
HOME_URL="https://www.debian.org/"; SUPPORT_URL="https://www.debian.org/support"; 
BUG_REPORT_URL="https://bugs.debian.org/";

### Versions of Apache Airflow Providers

apache-airflow-providers-celery==3.8.3
apache-airflow-providers-cncf-kubernetes==10.1.0
apache-airflow-providers-common-compat==1.2.1
apache-airflow-providers-common-io==1.4.2
apache-airflow-providers-common-sql==1.19.0
apache-airflow-providers-fab==1.5.2
apache-airflow-providers-ftp==3.11.1
apache-airflow-providers-http==4.13.2
apache-airflow-providers-imap==3.7.0
apache-airflow-providers-smtp==1.8.0
apache-airflow-providers-sqlite==3.9.0

### Deployment

Other

### Deployment details

We use a slightly modified version of offical helm chart

### Anything else?

_No response_

### Are you willing to submit PR?

- [ ] 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)


GitHub link: https://github.com/apache/airflow/discussions/56767

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to