itej13 commented on code in PR #69099:
URL: https://github.com/apache/airflow/pull/69099#discussion_r3489874992
##########
airflow-core/src/airflow/models/dagbag.py:
##########
@@ -104,7 +107,14 @@ def __init__(
def _read_dag(self, serdag: SerializedDagModel) -> SerializedDAG | None:
"""Read and cache a SerializedDAG (with its ``dag_hash`` for staleness
detection)."""
serdag.load_op_links = self.load_op_links
- dag = serdag.dag
+ try:
+ dag = serdag.dag
+ except Exception:
Review Comment:
Good catch, thanks. You're right that `except Exception` masks unrelated
serving-path failures as 404s.
I traced the actual exceptions out of `SerializedDagModel.dag` / `from_dict`
and narrowed the catch to `(DeserializationError, ValueError, KeyError,
zlib.error)`:
- `DeserializationError` — `deserialize_dag`'s wrapper for a
malformed/incompatible blob (and missing `dag_id`)
- `ValueError` — unknown `__version`, bad JSON (`JSONDecodeError`),
non-dict/str data, and `TimetableNotRegistered` (a `ValueError` subclass) for
an unregistered custom timetable
- `KeyError` — blob missing the top-level `dag` key
- `zlib.error` — a corrupt compressed `data_compressed` column
DB errors and genuine bugs in the serving path now propagate as 500 again
instead of being masked. I also added
`test__read_dag_propagates_unrelated_errors` asserting an unrelated
`RuntimeError` is not swallowed, and parametrized the not-found test over the
deserialization errors above.
One thing worth noting from tracing it: an unimportable operator class does
*not* raise here — the serializer is lenient about operator types — so that
scenario didn't need handling.
---
Drafted-by: Claude Code (Opus 4.8) (no human review before posting)
--
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]