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

template rendering issue in passing templates_dict param using task decorator #26390

Merged
merged 1 commit into from Sep 19, 2022

Conversation

Bowrna
Copy link
Contributor

@Bowrna Bowrna commented Sep 14, 2022

closes: #22072
Fix for the following issue:
The filenames inside the templates_dict is rendered in PythonOperator while it doesn't get rendered when passed as parameter using @task decorator.

This PR fixes the issue and updates the documentation and adds in the system test.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added area:core-operators Operators, Sensors and hooks within Core Airflow kind:documentation labels Sep 14, 2022
@Bowrna Bowrna force-pushed the file_rendering_task_decorator branch 2 times, most recently from e0555d9 to 0846183 Compare September 14, 2022 14:44
Comment on lines +38 to +39
template_fields: Sequence[str] = ('templates_dict', 'op_args', 'op_kwargs')
template_fields_renderers = {"templates_dict": "json", "op_args": "py", "op_kwargs": "py"}
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test for the case you are mentioning

@Bowrna Bowrna force-pushed the file_rendering_task_decorator branch 3 times, most recently from 976dd52 to f9fd527 Compare September 16, 2022 10:05
@Bowrna Bowrna closed this Sep 16, 2022
@Bowrna Bowrna reopened this Sep 16, 2022
@Bowrna Bowrna force-pushed the file_rendering_task_decorator branch 3 times, most recently from a3429c5 to a138bf9 Compare September 17, 2022 09:47
@Bowrna Bowrna closed this Sep 17, 2022
@Bowrna Bowrna reopened this Sep 17, 2022
@Bowrna Bowrna closed this Sep 18, 2022
@Bowrna Bowrna reopened this Sep 18, 2022
@Bowrna Bowrna force-pushed the file_rendering_task_decorator branch 2 times, most recently from 63ced93 to 170417a Compare September 18, 2022 12:27
@Bowrna Bowrna force-pushed the file_rendering_task_decorator branch from 170417a to 88f6bf1 Compare September 19, 2022 10:09
@potiuk potiuk merged commit 4bf0cb9 into apache:main Sep 19, 2022
@Bowrna
Copy link
Contributor Author

Bowrna commented Sep 20, 2022

@kaxil I will add the tests for this PR as a separate PR. This PR got merged before adding the test

@jedcunningham jedcunningham added this to the Airflow 2.4.1 milestone Sep 23, 2022
@jedcunningham jedcunningham added the type:bug-fix Changelog: Bug Fixes label Sep 23, 2022
jedcunningham pushed a commit that referenced this pull request Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core-operators Operators, Sensors and hooks within Core Airflow kind:documentation type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@task decorator does not handle "templates_exts" argument correctly (files are not rendered)
4 participants