uranusjr commented on code in PR #37028:
URL: https://github.com/apache/airflow/pull/37028#discussion_r1625658753


##########
airflow/models/abstractoperator.py:
##########
@@ -730,12 +733,15 @@ def _do_render_template_fields(
                 pass
 
             try:
-                rendered_content = self.render_template(
-                    value,
-                    context,
-                    jinja_env,
-                    seen_oids,
-                )
+                if callable(value):
+                    rendered_content = value(self.render_value, context, 
jinja_env)

Review Comment:
   I think this is enough:
   
   ```suggestion
                       rendered_content = value(context=context, 
jinja_env=jinja_env)
   ```
   
   The current operator is available in `context["task"]` so we can instruct 
users to call `render_value` on that with the appropriate arguments if they 
need to render templates inside the callable.
   
   Also it might be a good idea to always pass named arguments (and in the 
documentation tell the users to always use these names) so it’s easier to 
extend the interface in the future if we need to. We had a similar problem 
before with operator links (where we didn’t plan ahead and had problems when 
more arguments needed to be added).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to