tirkarthi commented on issue #58560:
URL: https://github.com/apache/airflow/issues/58560#issuecomment-3565618731

   I am able to reproduce this and will raise a PR. The issue is that there 
could be multiple dagruns with same run_id like 
`scheduled__2024-07-13T00:00:00+00:00` which can be two dagruns associated with 
two dags on same schedule. So when a dagrun is marked as success it queries the 
dagruns associated with the run_id to delete the deadline associated with them. 
During this it can get other dagruns that are still in running state as part of 
other dags with no end_date causing this issue.
   
   
https://github.com/apache/airflow/blob/5135f18daafe0f5d7e16985da88f377b32cdb810/airflow-core/src/airflow/models/dagrun.py#L1269
   
   Something like below or even better just query by `{DagRun.id: self.id}`
   
   ```python
   Deadline.prune_deadlines(session=session, conditions={DagRun.run_id: 
self.run_id, DagRun.dag_id: self.dag_id}) 
   ```


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