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


##########
airflow-core/src/airflow/serialization/definitions/deadline.py:
##########
@@ -169,23 +155,14 @@ def deserialize_reference(cls, reference_data: dict):
     class DagRunLogicalDateDeadline(SerializedBaseDeadlineReference):
         """A deadline that returns a DagRun's logical date."""
 
-        required_kwargs = {"dag_id", "run_id"}
-
-        def _evaluate_with(self, *, session: Session, **kwargs: Any) -> 
datetime | None:
-            from airflow.models import DagRun
-
-            return _fetch_from_db(DagRun.logical_date, session=session, 
**kwargs)
+        def _evaluate_with(self, *, session: Session, dagrun: 
DeadlineDagRunProtocol) -> datetime | None:
+            return dagrun.logical_date

Review Comment:
   There are a few ways that `dagrun.logical_date` can be `None`, causing 
`dag.py:769` to silently skip the insert.  `_fetch_from_db` used to log in that 
case, and removing that method call was necessary, but now we don't have 
anything logging it.  It's worth adding a log here to replace that one, 
something like 
   
   ```
   if dagrun.logical_date is None:
       self.log.warning("No deadline created for %s: the Dag run has no logical 
date.", dagrun.dag_id)
   return dagrun.logical_date
   ```
   
   The same applies below on `return dagrun.queued_at`.



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