kalluripradeep commented on code in PR #61019:
URL: https://github.com/apache/airflow/pull/61019#discussion_r3340896862


##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -430,9 +430,10 @@ def deactivate_stale_dags(
         for dag in dags_parsed:
             # Dags whose bundle has been removed from config (bundle no longer 
active) are stale —
             # the processor has stopped parsing their files, so the time-based 
check below would never fire.
-            if dag.bundle_name in inactive_bundles:
+            # Legacy DAGs with a NULL bundle_name (e.g. from Airflow 2.x) are 
also stale, as they will never be parsed.
+            if dag.bundle_name is None or dag.bundle_name in inactive_bundles:

Review Comment:
   The `bundle_name` is updated during parsing when the DAG processor reads the 
DAG files for a bundle (setting it to the name of the bundle, e.g., 
`'dags-folder'`).
   
   However, in the upgrade scenario described in #60763, legacy DAGs are 
removed/deleted *at the same time* as the upgrade. Because their source files 
are gone, the DAG processor will never parse them again, and they will never 
have their `bundle_name` updated—it will remain `None`/`NULL` in the database 
forever.
   
   Since their `bundle_name` remains `None`, they are never identified as stale 
under active bundles and thus are never deactivated, causing them to persist in 
the UI indefinitely. The query change ensures these legacy, deleted DAGs are 
caught and deactivated.



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