eladkal commented on code in PR #29821:
URL: https://github.com/apache/airflow/pull/29821#discussion_r1121242914
##########
airflow/serialization/serialized_objects.py:
##########
@@ -770,8 +772,12 @@ def _serialize_node(cls, op: BaseOperator |
MappedOperator, include_deps: bool)
# Store all template_fields as they are if there are JSON Serializable
# If not, store them as strings
+ # And raise an exception if the field is not templateable
+ forbidden_fields =
set(inspect.signature(BaseOperator.__init__).parameters.keys())
if op.template_fields:
for template_field in op.template_fields:
+ if template_field in forbidden_fields:
+ raise AirflowException(f"Cannot use {template_field} as
template field")
Review Comment:
I think the only case where we can not template fields is when user wants to
template BaseOperator parameters which is something that can't be done. So
maybe we can be more informative on the exception here?
--
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]