This is an automated email from the ASF dual-hosted git repository.

bbovenzi 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 4a12bdb245 Bugfix, prevent force of unpause on trigger DAG (#32456)
4a12bdb245 is described below

commit 4a12bdb2451aa53626da05d197d85c2a34d459fc
Author: Jens Scheffler <[email protected]>
AuthorDate: Thu Jul 13 05:55:57 2023 +0200

    Bugfix, prevent force of unpause on trigger DAG (#32456)
---
 airflow/www/templates/airflow/dag.html  |  4 ++--
 airflow/www/templates/airflow/dags.html |  2 +-
 airflow/www/views.py                    | 15 +++++++++++----
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/airflow/www/templates/airflow/dag.html 
b/airflow/www/templates/airflow/dag.html
index 66531c607e..754e17262a 100644
--- a/airflow/www/templates/airflow/dag.html
+++ b/airflow/www/templates/airflow/dag.html
@@ -221,9 +221,9 @@
       <div class="col-md-2">
         <div class="btn-group pull-right">
           {% if 'dag_id' in request.args %}
-            <a href="{{ url_for('Airflow.trigger', dag_id=dag.dag_id, 
origin=url_for(request.endpoint, **request.args), unpause=True) }}"
+            <a href="{{ url_for('Airflow.trigger', dag_id=dag.dag_id, 
origin=url_for(request.endpoint, **request.args)) }}"
           {% else %}
-            <a href="{{ url_for('Airflow.trigger', dag_id=dag.dag_id, 
origin=url_for(request.endpoint, dag_id=dag.dag_id, **request.args), 
unpause=True) }}"
+            <a href="{{ url_for('Airflow.trigger', dag_id=dag.dag_id, 
origin=url_for(request.endpoint, dag_id=dag.dag_id, **request.args)) }}"
           {% endif %}
               title="Trigger&nbsp;DAG"
               aria-label="Trigger DAG"
diff --git a/airflow/www/templates/airflow/dags.html 
b/airflow/www/templates/airflow/dags.html
index 3399051192..f575ece3b1 100644
--- a/airflow/www/templates/airflow/dags.html
+++ b/airflow/www/templates/airflow/dags.html
@@ -364,7 +364,7 @@
               <div class="btn-group">
                 {# Use dag_id instead of dag.dag_id, because the DAG might not 
exist in the webserver's DagBag #}
                 {% if dag %}
-                  <a href="{{ url_for('Airflow.trigger', dag_id=dag.dag_id, 
redirect_url=url_for(request.endpoint), unpause=True) }}"
+                  <a href="{{ url_for('Airflow.trigger', dag_id=dag.dag_id, 
redirect_url=url_for(request.endpoint)) }}"
                     title="Trigger&nbsp;DAG"
                     aria-label="Trigger DAG"
                     class="btn btn-sm btn-default btn-icon-only{{ ' disabled' 
if not dag.can_trigger }} trigger-dropdown-btn">
diff --git a/airflow/www/views.py b/airflow/www/views.py
index a18429a1a9..a62a966eeb 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -2159,10 +2159,17 @@ class Airflow(AirflowBaseView):
                     recent_confs=recent_confs,
                 )
 
-        if unpause and dag.get_is_paused():
-            dag_model = models.DagModel.get_dagmodel(dag_id)
-            if dag_model is not None:
-                dag_model.set_is_paused(is_paused=False)
+        if dag.get_is_paused():
+            if unpause or not ui_fields_defined:
+                flash(f"Unpaused DAG {dag_id}.")
+                dag_model = models.DagModel.get_dagmodel(dag_id)
+                if dag_model is not None:
+                    dag_model.set_is_paused(is_paused=False)
+            else:
+                flash(
+                    f"DAG {dag_id} is paused, unpause if you want to have the 
triggered run being executed.",
+                    "warning",
+                )
 
         try:
             dag.create_dagrun(

Reply via email to