From 549fac30eeefaa449df9bfdf58eb40a008e9fe75 Mon Sep 17 00:00:00 2001 From: Aleksey Kirilishin <54231417+avkirilishin@users.noreply.github.com> Date: Sun, 3 Dec 2023 05:11:15 +0400 Subject: [PATCH] 34058: Fix UI Grid error when DAG has been removed. (#36028) --- airflow/www/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/airflow/www/views.py b/airflow/www/views.py index c4230c1900bc2..f51fbb9e79c93 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -3013,6 +3013,9 @@ def legacy_graph(self): def graph(self, dag_id: str, session: Session = NEW_SESSION): """Redirect to the replacement - grid + graph. Kept for backwards compatibility.""" dag = get_airflow_app().dag_bag.get_dag(dag_id, session=session) + if not dag: + flash(f'DAG "{dag_id}" seems to be missing from DagBag.', "error") + return redirect(url_for("Airflow.index")) dt_nr_dr_data = get_date_time_num_runs_dag_runs_form_data(request, session, dag) dttm = dt_nr_dr_data["dttm"] dag_run = dag.get_dagrun(execution_date=dttm)