-
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
feature: callable for template_fields #37028
feature: callable for template_fields #37028
Conversation
6adddf1
to
27f2764
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.
Can you add the test cases for the change?
I wonder if we should turn the return value of the callable into a template and render that. Since a callable can do whatever it wants, supporting returning a template seems redundant and may induce some confusing behaviours (the same as As a side note, I wonder if the callable should take |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
5bcb001
to
4cfb46b
Compare
4cfb46b
to
d6a858a
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.
Yeah after some more thought I really do not like the fact that the return value gets treated as a template string. The callable should just return the rendered value instead. This is what we do with XComArg—a resolved XCom value is treated as-is, not rendered again as a template.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
no stale |
d6a858a
to
520170b
Compare
@uranusjr thanks for your review , wdyt of this second implementation ? |
520170b
to
3fe6ec3
Compare
The idea looks fine to me, but this should be a part of I wonder if we should make this a part of |
9e72a7b
to
ebe6e33
Compare
@uranusjr thanks again, I did the change |
Also we need documentation on this. |
yeah I will when we find the final implementation |
Design looks good now to me. |
fa4dfda
to
f6c93b5
Compare
@uranusjr could you pls review the doc commit , thanks |
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 touched up the documentation so the full document reads better. Looks good to me now. Does this work with nested fields?
PythonOperator(
...,
op_kwargs={"foo": render_foo}, # Is this callable rendered?
)
We probably should not allow this since it would be a bit confusing.
thanks for the doc , I added a new test about nested fields |
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.
Very good idea and implementation.
--------- Co-authored-by: raphaelauv <[email protected]> Co-authored-by: Tzu-ping Chung <[email protected]>
following discussion of #35844
revert templating from #31362