ferruzzi commented on code in PR #62918:
URL: https://github.com/apache/airflow/pull/62918#discussion_r3230130473


##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -1267,6 +1255,21 @@ def recalculate(self) -> _UnfinishedStates:
                 self.data_interval_start,
                 self.data_interval_end,
             )
+
+
+            if dag.deadline:
+                # The dagrun has reached a terminal state. Prune any pending 
deadlines
+                # so they don't fire after the run is already finished.
+                deadline_alerts = [
+                    DeadlineAlertModel.get_by_id(alert_id, session) for 
alert_id in dag.deadline
+                ]
+
+                if any(
+                    deadline_alert.reference_class in 
SerializedReferenceModels.TYPES.DAGRUN
+                    for deadline_alert in deadline_alerts

Review Comment:
   Honestly, I don't really think this is necessary and I'd just resolve it.  
Seems like over-optimizing around an edge case where a dagrun has many 
deadlines as opposed to just using the exiting helper that serves the same 
purpose. 



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