Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set context inside templates #33645

Merged
merged 7 commits into from
Aug 24, 2023

Conversation

ivan-afonichkin
Copy link
Contributor

Setting the context while rendering templates.

Closes: #33217.


Comment on lines +2917 to +2918
ti._run_raw_task()
assert ti.state == State.SUCCESS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to actually run the task, or can we only test the rendering part? Less moving parts if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's implemented as setting a context for rendering templates inside _execute_task_with_callbacks. I'm not aware perhaps, but is there a way to run _execute_task_with_callbacks without actually running a task? Or do you think there is a better place to set up this context?

@ivan-afonichkin
Copy link
Contributor Author

@uranusjr thanks a lot for the review. Should someone else review it or it could be merged?

@potiuk potiuk merged commit 9fa782f into apache:main Aug 24, 2023
42 checks passed
@potiuk potiuk added this to the Airflow 2.7.1 milestone Aug 24, 2023
@potiuk
Copy link
Member

potiuk commented Aug 24, 2023

@uranusjr thanks a lot for the review. Should someone else review it or it could be merged?

Did. Merged. Marked for 2.7.1

@uranusjr
Copy link
Member

I was actually wondering if the context should be set inside render_templates instead, but I guess that can be done in a later PR.

@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Aug 28, 2023
ephraimbuddy pushed a commit that referenced this pull request Aug 28, 2023
* Set context inside templates

---------

Co-authored-by: Ivan Afonichkin <[email protected]>
Co-authored-by: Tzu-ping Chung <[email protected]>
(cherry picked from commit 9fa782f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_current_context not present in user_defined_macros
4 participants