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

   deadlines are pruned only when the dagrun succeeds. In case dagrun fails the 
deadline remains in the db to be picked up by the scheduler to handle deadline 
miss. Is this an expected behavior as ?
   
   ```
   mysql> select *, now() from deadline limit 1 offset 1 \G;
   *************************** 1. row ***************************
                  id: 019bfab13d55744d9a2f62505186e5e6
           dagrun_id: 182
       deadline_time: 2026-01-26 19:55:38.195294
              missed: 0
         callback_id: 019bfab13d5472dbaaa0a8118b988a1d
   deadline_alert_id: 019bfaad9e5e79eea4c061ac9f48adf6
          created_at: 2026-01-26 19:54:38.229966
     last_updated_at: 2026-01-26 19:54:38.229976
               now(): 2026-01-26 19:55:25
   1 row in set (0.00 sec)
   
   mysql> select * from dag_run where id = 182 \G;
   *************************** 1. row ***************************
                         id: 182
                     dag_id: gh60927
                  queued_at: 2026-01-26 19:54:38.195294
               logical_date: 2026-01-26 19:54:36.000000
                 start_date: 2026-01-26 19:54:39.375827
                   end_date: 2026-01-26 19:55:01.806481
                      state: failed
                     run_id: manual__2026-01-26T14:24:38.181308+00:00
            creating_job_id: NULL
                   run_type: manual
               triggered_by: UI
       triggering_user_name: admin
                       conf: {}
        data_interval_start: 2026-01-26 19:54:36.000000
          data_interval_end: 2026-01-26 19:54:36.000000
                  run_after: 2026-01-26 19:54:38.181308
   last_scheduling_decision: 2026-01-26 19:55:01.803274
            log_template_id: 1
                 updated_at: 2026-01-26 19:55:01.807175
               clear_number: 0
                backfill_id: NULL
             bundle_version: NULL
        scheduled_by_job_id: 7
            context_carrier: {"__var": {}, "__type": "dict"}
                span_status: ended
     created_dag_version_id: 019bfaad9e7975349bc777ebf366a7aa
              partition_key: NULL
   1 row in set (0.00 sec)
   
   ERROR: 
   No query specified
   ```
   
   After the dagrun is marked as failed the deadline is not pruned and is 
handled by scheduler to be marked as missed.
   
   ```
   mysql> select *, now() from deadline limit 1 offset 1 \G;
   *************************** 1. row ***************************
                  id: 019bfab13d55744d9a2f62505186e5e6
           dagrun_id: 182
       deadline_time: 2026-01-26 19:55:38.195294
              missed: 1
         callback_id: 019bfab13d5472dbaaa0a8118b988a1d
   deadline_alert_id: 019bfaad9e5e79eea4c061ac9f48adf6
          created_at: 2026-01-26 19:54:38.229966
     last_updated_at: 2026-01-26 19:55:38.663270
               now(): 2026-01-26 19:55:45
   1 row in set (0.00 sec)
   
   ```
   
   
https://github.com/apache/airflow/blob/4e8274c3616fde8b59f633b543af3509148f2bc1/airflow-core/src/airflow/models/dagrun.py#L1266-L1276
   
   `prune_deadlines` indicates only successful dagruns are pruned.
   
   
https://github.com/apache/airflow/blob/4e8274c3616fde8b59f633b543af3509148f2bc1/airflow-core/src/airflow/models/deadline.py#L153-L163


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