Closed vanchaxy closed 4 months ago
Thanks for opening your first issue here! Be sure to follow the issue template!
You seem to know what you want to do - would you like to propose a PR for that? Discussing on actual PR would be much more productive and you could become one of the > 2K contributors to airflow this way.
I will try to propose a PR. Just need some time to configure env and read guidelines.
This issue not reproduce in main branch. Therefore closing this issue.
Description
Allow context usage in user_defined_macros. For this move
set_current_context
context manager from wrapping _execute_task to wrapping _execute_task_with_callbacks.Use case/motivation
After this change, we will be able to use
get_current_context
while rendering template fields.Example use case. We have dag with the first task that prepares configuration for this run and after this, all other task uses this config to render templates. We have no control over other task codes, as it's providers operators etc.
After this change we can define class like:
Then we can use this in all templates as
config.needed_key
.For now, if we want something similar we need to define function like:
and use it in all templates as
get_config(ti).needed_key
Related issues
No response
Are you willing to submit a PR?
Code of Conduct