Rares Cosma created AIRFLOW-6849:
------------------------------------

             Summary: /blocked route of API blows up after removing DAGs from 
the dag store
                 Key: AIRFLOW-6849
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6849
             Project: Apache Airflow
          Issue Type: Bug
          Components: DagRun
    Affects Versions: 1.10.7
            Reporter: Rares Cosma


The airflow webserver blows up with a `KeyError` after DAGs have been removed 
from the dag store when accessing the `/blocked` route. 

This route is accessed (for whatever reason) by an XHR call when loading the 
UI. 

The culprit is `www_rbac/views.py`

To get rid of the 500 errors in our environment we had to patch it the 
following way:
{code:java}
--- www_rbac/views.py   2020-02-19 06:46:11.146009824 +0100
+++ www_rbac/views.py   2020-02-19 06:45:41.109343503 +0100
@@ -1082,10 +1082,13 @@             for dag_id, active_dag_runs in dags:
                 dag = dagbag.get_dag(dag_id)
-                max_active_runs = dagbag.dags[dag_id].max_active_runs
                 if dag:
                     # TODO: Make max_active_runs a column so we can query for 
it directly
                     max_active_runs = dag.max_active_runs
+                elif dag_id in dagbag.dags:
+                    max_active_runs = dagbag.dags[dag_id].max_active_runs
+                else:
+                    continue
                 payload.append({
                     'dag_id': dag_id,
                     'active_dag_run': active_dag_runs, {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to