m8719-github opened a new issue, #60064:
URL: https://github.com/apache/airflow/issues/60064

   ### Apache Airflow version
   
   3.1.5
   
   ### If "Other Airflow 3 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Operator template fields may be provided via callable of the form:  `def 
fn(context, jinja_env)`
   These template field callables are serialized via default `str` which 
includes current address of the callable: `<function fn at 0x7592eb0cb380>`
   The address of the loaded callable changes between iterations of the 
dag-processor DAG refresh loop and since DAG versioning depends on stable 
serialization, this leads to DAG version explosion.
   
   ### What you think should happen instead?
   
   Operator template fields serialization is treated separately 
[here](https://github.com/apache/airflow/blob/07ef94e6e966a2bf5d1a159e084a602b30263737/airflow-core/src/airflow/serialization/serialized_objects.py#L1124)
 and 
[serialize_template_field](https://github.com/apache/airflow/blob/07ef94e6e966a2bf5d1a159e084a602b30263737/airflow-core/src/airflow/serialization/helpers.py#L32)
 does not handle callable case.
   Instead template field callables should be serialized via already existing 
logic 
[here](https://github.com/apache/airflow/blob/07ef94e6e966a2bf5d1a159e084a602b30263737/airflow-core/src/airflow/serialization/serialized_objects.py#L617).
   
   ### How to reproduce
   
   Create a simple DAG with a single task with template fields, configure any 
of the template fields to be provided via callable: `def fn(context, jinja_env)`
   Watch DAG versions increment indefinitely.
   
   ### Operating System
   
   Ubuntu 24.04.3 LTS
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-amazon==9.18.1
   apache-airflow-providers-cncf-kubernetes==10.11.1
   apache-airflow-providers-common-compat==1.10.1
   apache-airflow-providers-common-io==1.7.0
   apache-airflow-providers-common-sql==1.30.1
   apache-airflow-providers-databricks==7.8.1
   apache-airflow-providers-datadog==3.10.1
   apache-airflow-providers-ftp==3.14.0
   apache-airflow-providers-http==5.6.1
   apache-airflow-providers-mysql==6.4.0
   apache-airflow-providers-openlineage==2.9.1
   apache-airflow-providers-pagerduty==5.2.1
   apache-airflow-providers-sftp==5.5.1
   apache-airflow-providers-slack==9.6.1
   apache-airflow-providers-smtp==2.4.1
   apache-airflow-providers-ssh==4.2.1
   apache-airflow-providers-standard==1.10.1
   apache-airflow-providers-trino==6.4.1
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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