Skip to content

Make the decorators of PythonOperator sub-classes extend its decorator#32845

Merged
hussein-awala merged 2 commits into
apache:mainfrom
hussein-awala:fix_python_decorators_ops
Jul 31, 2023
Merged

Make the decorators of PythonOperator sub-classes extend its decorator#32845
hussein-awala merged 2 commits into
apache:mainfrom
hussein-awala:fix_python_decorators_ops

Conversation

@hussein-awala

@hussein-awala hussein-awala commented Jul 25, 2023

Copy link
Copy Markdown
Member

closes: #32840

This PR makes the decorator classes for the sub-classes of PythonOperator extend _PythonDecoratedOperator instead of DecoratedOperator, in this case they inherit its constructor and its attributes (including template_fields and template_fields_renderers which are missing).


^ 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.

@hussein-awala hussein-awala added the type:bug-fix Changelog: Bug Fixes label Jul 25, 2023
@hussein-awala hussein-awala added this to the Airflow 2.6.4 milestone Jul 25, 2023
@hussein-awala hussein-awala changed the title Fix template_fields in the decorators of PythonOperator sub-classes Make the decorators of PythonOperator sub-classes extend its decorator Jul 25, 2023
@hussein-awala

Copy link
Copy Markdown
Member Author

I think the solution implemented in the second commit is much better than the first one.

@hussein-awala
hussein-awala requested review from potiuk and uranusjr July 25, 2023 23:12

@uranusjr uranusjr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense

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.

Usage of templates_dict in short_circuit decorated task

3 participants