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


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -181,6 +183,48 @@ def _stop_remaining_tasks(*, task_instance: TaskInstance, 
task_teardown_map=None
             log.info("Not skipping teardown task '%s'", ti.task_id)
 
 
+def _recalculate_dagrun_queued_at_deadlines(
+    dagrun: DagRun, new_queued_at: datetime, session: Session
+) -> None:
+    """
+    Recalculate deadline times for deadlines that reference dagrun.queued_at.
+
+    :param dagrun: The DagRun whose deadlines should be recalculated
+    :param new_queued_at: The new queued_at timestamp to use for calculation
+    :param session: Database session
+
+    :meta private:
+    """
+    deadlines = session.scalars(
+        select(Deadline).where(
+            Deadline.dagrun_id == dagrun.id,
+            Deadline.missed == false(),
+        )
+    ).all()
+
+    if not deadlines:
+        return
+
+    for deadline in deadlines:
+        if deadline.deadline_alert_id:
+            if deadline_alert := session.get(DeadlineAlertModel, 
deadline.deadline_alert_id):
+                reference_type = 
deadline_alert.reference.get(ReferenceModels.REFERENCE_TYPE_FIELD)
+                if reference_type == 
ReferenceModels.DagRunQueuedAtDeadline.__name__:

Review Comment:
   Same as above; thanks.



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