deepak4babu opened a new issue, #51887:
URL: https://github.com/apache/airflow/issues/51887

   ### Description
   
   Add ability to set context for airflow triggers that can be used all the 
modules used in the trigger co-routine.
   
   ### Use case/motivation
   
   In our airflow setup, we run the same dag for multiple teams. The context 
for each team like team ID is set at runtime using environment variables. The 
team id is used to access team specific services like db, blobs etc. 
   
   The reason for using environment variable is the convenience of accessing 
the value in all python modules without having to pass it as a variable to all 
methods.
   
   This is working fine for running normal tasks in celery workers.
   
   When it comes to triggerer, we are not able to achieve this using 
environment variables (or threading.local()), as triggerer is a single process, 
single thread service. Tried using contextvars, but the values set is not 
accessible from all modules.
   
   Is there any way to achieve this?
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a 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)
   


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

Reply via email to