This is an automated email from the ASF dual-hosted git repository.
ephraimanierobi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 2f88009 Fix error on triggering a dag that doesn't exist using
dagrun_conf (#18655)
2f88009 is described below
commit 2f88009bbf8818f3b4b553a04ae3b848af43c4aa
Author: Ephraim Anierobi <[email protected]>
AuthorDate: Fri Oct 1 16:01:18 2021 +0100
Fix error on triggering a dag that doesn't exist using dagrun_conf (#18655)
We currently show a nice error message when the trigger button is clicked
but clicking on trigger DAG w/conf for a dag that doesn't exist anymore,
takes us to enter configuration. When you eventually trigger, you get error
messages.
This PR fixes it
---
airflow/www/views.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 11ea3f6..1db73c8 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -1623,6 +1623,10 @@ class Airflow(AirflowBaseView):
request_execution_date = request.values.get('execution_date',
default=timezone.utcnow().isoformat())
is_dag_run_conf_overrides_params = conf.getboolean('core',
'dag_run_conf_overrides_params')
dag = current_app.dag_bag.get_dag(dag_id)
+ dag_orm = session.query(models.DagModel).filter(models.DagModel.dag_id
== dag_id).first()
+ if not dag_orm:
+ flash(f"Cannot find dag {dag_id}")
+ return redirect(origin)
if request.method == 'GET':
# Populate conf textarea with conf requests parameter, or
dag.params
@@ -1650,11 +1654,6 @@ class Airflow(AirflowBaseView):
is_dag_run_conf_overrides_params=is_dag_run_conf_overrides_params,
)
- dag_orm = session.query(models.DagModel).filter(models.DagModel.dag_id
== dag_id).first()
- if not dag_orm:
- flash(f"Cannot find dag {dag_id}")
- return redirect(origin)
-
try:
execution_date = timezone.parse(request_execution_date)
except ParserError: