This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 0cb169f0884 Update the list of nullable properties on 
LazyDeserializedDAG (#55833)
0cb169f0884 is described below

commit 0cb169f08842100f61a67e1df65d7c71db6efe5a
Author: Ash Berlin-Taylor <a...@apache.org>
AuthorDate: Thu Sep 18 16:46:09 2025 +0100

    Update the list of nullable properties on LazyDeserializedDAG (#55833)
    
    * Update the list of nullable properties on LazyDeserializedDAG
    
    A quick not-perfect code snippet that generated this list:
    
    ```python
    import operator
    
    import attrs
    
    from airflow.sdk import DAG
    
    default_qual_name = 
operator.attrgetter("default.factory.func.__func__.__qualname__")
    
    def is_conf_default(fld):
        try:
            return default_qual_name(fld).startswith("AirflowConfigParser.get")
        except Exception:
            return None
    
    [field.name for field in attrs.fields(airflow.sdk.DAG) if "None" in 
field.type or is_conf_default(field)]
    ```
    
    This snippet is not perfect, it's just a starting point, which is why it 
isn't
    yet turned in to a pre-commit check
    
    * Apply suggestions from code review
    
    * Update airflow-core/src/airflow/serialization/serialized_objects.py
    
    ---------
    
    Co-authored-by: Kaxil Naik <kaxiln...@gmail.com>
---
 .../airflow/serialization/serialized_objects.py    | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/airflow-core/src/airflow/serialization/serialized_objects.py 
b/airflow-core/src/airflow/serialization/serialized_objects.py
index 4801eda3311..ad85dcc3806 100644
--- a/airflow-core/src/airflow/serialization/serialized_objects.py
+++ b/airflow-core/src/airflow/serialization/serialized_objects.py
@@ -3792,16 +3792,32 @@ class LazyDeserializedDAG(pydantic.BaseModel):
     last_loaded: datetime.datetime | None = None
 
     NULLABLE_PROPERTIES: ClassVar[set[str]] = {
-        "is_paused_upon_creation",
+        # Non attr fields that should be nullable, or attrs with a different 
default
         "owner",
+        "owner_links",
         "dag_display_name",
+        "has_on_success_callback",
+        "has_on_failure_callback",
+        # Attr properties that are nullable, or have a default that loads from 
config
         "description",
-        "relative_fileloc",
+        "start_date",
+        "end_date",
+        "template_searchpath",
+        "user_defined_macros",
+        "user_defined_filters",
         "max_active_tasks",
         "max_active_runs",
         "max_consecutive_failed_dag_runs",
-        "owner_links",
+        "dagrun_timeout",
+        "deadline",
+        "catchup",
+        "doc_md",
         "access_control",
+        "is_paused_upon_creation",
+        "jinja_environment_kwargs",
+        "relative_fileloc",
+        "disable_bundle_versioning",
+        "last_loaded",
     }
 
     @classmethod

Reply via email to