ferruzzi commented on code in PR #55086:
URL: https://github.com/apache/airflow/pull/55086#discussion_r2320269025
##########
airflow-core/src/airflow/models/dag.py:
##########
@@ -2009,12 +2012,25 @@ def next_dagrun_data_interval(self, value:
tuple[datetime, datetime] | None) ->
@property
def deadline(self):
"""Get the deserialized deadline alert."""
- return DeadlineAlert.deserialize_deadline_alert(self._deadline) if
self._deadline else None
+ if self._deadline is None:
+ return None
+ if isinstance(self._deadline, list):
+ return [DeadlineAlert.deserialize_deadline_alert(item) for item in
self._deadline]
+ return DeadlineAlert.deserialize_deadline_alert(self._deadline)
@deadline.setter
def deadline(self, value):
"""Set and serialize the deadline alert."""
- self._deadline = value if isinstance(value, dict) else
value.serialize_deadline_alert()
+ if value is None:
+ self._deadline = None
+ elif isinstance(value, list):
+ self._deadline = [
+ item if isinstance(item, dict) else
item.serialize_deadline_alert() for item in value
+ ]
Review Comment:
Nitpick, feel free to resolve as out of scope. I wonder if we want to let
the user provide a tuple or a list. At face value, it seems like an easy
addition of the second type to your isinstance check: `isinstance(value, (list,
tuple))` ... but maybe I'm not thinking this through all the way. Either way,
internally we are converting and storing it as a list so maybe it's a "free"
feature?
--
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]