ashb commented on code in PR #58111:
URL: https://github.com/apache/airflow/pull/58111#discussion_r2523307645


##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -2585,7 +2593,11 @@ def _deserialize_dag_internal(
             elif k == "dagrun_timeout":
                 v = cls._deserialize_timedelta(v)
             elif k.endswith("_date"):
-                v = cls._deserialize_datetime(v)
+                # Skip deserialization for strings containing Jinja templates
+                if isinstance(v, str) and cls._contains_jinja(v):
+                    pass  # Keep as-is for runtime rendering

Review Comment:
   Ditto



##########
airflow-core/src/airflow/dag_processing/dagbag.py:
##########
@@ -552,7 +552,12 @@ def _process_modules(self, filepath, mods, 
file_last_changed_on_disk):
                 pass
             except Exception as e:
                 self.log.exception("Failed to bag_dag: %s", dag.fileloc)
-                self.import_errors[relative_fileloc] = f"{type(e).__name__}: 
{e}"
+                if self.dagbag_import_error_tracebacks:
+                    self.import_errors[relative_fileloc] = 
traceback.format_exc(
+                        limit=-self.dagbag_import_error_traceback_depth
+                    )
+                else:
+                    self.import_errors[relative_fileloc] = 
f"{type(e).__name__}: {e}"

Review Comment:
   Sorry to be a pain, but this is likely a different change and not part of 
the bug fix.



##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -2107,6 +2112,9 @@ def _deserialize_field_value(cls, field_name: str, value: 
Any) -> Any:
         elif field_name == "resources":
             return Resources.from_dict(value) if value is not None else None
         elif field_name.endswith("_date"):
+            # Skip deserialization for strings containing Jinja templates
+            if isinstance(value, str) and cls._contains_jinja(value):
+                return value  # Keep as-is for runtime rendering

Review Comment:
   This change seems out of place -- why do we need this?



##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -2107,6 +2112,9 @@ def _deserialize_field_value(cls, field_name: str, value: 
Any) -> Any:
         elif field_name == "resources":
             return Resources.from_dict(value) if value is not None else None
         elif field_name.endswith("_date"):
+            # Skip deserialization for strings containing Jinja templates
+            if isinstance(value, str) and cls._contains_jinja(value):
+                return value  # Keep as-is for runtime rendering

Review Comment:
   Is this code really being hit for `op.args["end_date"]`? Rather than 
"_contains_jinja" the fix there should be to not hit this code path for things 
that aren't the top level fields.



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