From a05ecb44503308d5cd57b10b0435519ca32cf441 Mon Sep 17 00:00:00 2001 From: Hussein Awala Date: Sat, 9 Sep 2023 21:45:21 +0200 Subject: [PATCH] Replace assert by if...raise in www package --- airflow/www/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/airflow/www/views.py b/airflow/www/views.py index 8be5bb1ed101b..bd4efb211caf8 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -2287,7 +2287,11 @@ def _clear_dag_tis( except AirflowException as ex: return redirect_or_json(origin, msg=str(ex), status="error", status_code=500) - assert isinstance(tis, collections.abc.Iterable) + if not isinstance(tis, collections.abc.Iterable): + raise AssertionError( + f"Expected dag.clear() to return an iterable for dry runs, got {tis} instead." + ) + details = [str(t) for t in tis] if not details: