-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Remove callable functions parameter from kafka operator template_fields #42555
Conversation
869805c
to
26a177c
Compare
26a177c
to
7f03fb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure that removing these parameters is the right way to deal with it (then you'll break compatibility with older Airflow versions where it works).
@uranusjr / @raphaelauv - I would be happy for your feedback.
Yes I did the same for #39948 That was the only callable that was in the templated_fields of the operator that I detected thanks to a unit test breaking |
Thanks for the review. Yes i completely agree. but IMHO keeping these parameters also cause problems here. https://github.com/apache/airflow/blob/main/airflow/models/abstractoperator.py#L768 here the callable value args has only context and jinja_env, if the function does accepts more arguments this would fail ?. Happy for any other suggestions :) |
closes: #42502
The Kafka ConsumeFromTopicOperator and ProduceToTopicOperator are failing to resolve callable template fields. For a callable to work with template functions, it must accept both the context and jinja_env.
If we include
producer_function
andapply_function
in the template fields, all current users will need to modify their scripts to accept bothcontext
andjinja_env
. and some minor updates require in kafka operator.I also tested another scenario where the function does accept context and jinja_env, but in the UI template field, it appears as a generated type object(please check below screenshot). Since there isn’t much value in displaying this field as a generated type object, I believe it's better to remove these from the template fields altogether.
Any other suggestion please?
Removed the fields and executed kafka 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.