RehanAhmad25 opened a new pull request, #70072:
URL: https://github.com/apache/airflow/pull/70072

   Fail queued DagRuns with an unresolvable pinned dag version
   
   closes: #70056
   
   A DagRun pinned to a specific dag version (bundle_version + 
created_dag_version_id) can get stuck in QUEUED forever if the pinned version 
row is later deleted. The FK is ON DELETE SET NULL, so created_dag_version_id 
becomes NULL while bundle_version stays set, and _version_from_dag_run only 
falls back to the latest versionwhen bundle_version is unset. The run is 
neither started nor failed, logged and skipped on every scheduler loop 
indefinitely.
   
   This detects that specific, permanently-unresolvable case (pinned version 
deleted) and fails the run explicitly via set_state(), which correctly updates 
end_date along with the state transition. Other reasons get_dag_for_run can 
return None (e.g. an unpinned run whose version hasn't parsed yet) are left 
untouched, since those can still resolve on a later loop and shouldn't be 
failed outright.
   
   A second test confirms that scoping: an unpinned run with no resolvable 
version yet stays QUEUED rather than being failed.
   
   ---
   ##### Was generative AI tooling used to co-author this PR?
   - [X] Yes (Claude)
   
   Generated-by: Claude (Anthropic) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
    


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