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

jscheffl 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 47980c4384 Run Trigger Page: Configurable number of recent configs 
(#36878)
47980c4384 is described below

commit 47980c438415a91f8e1c410866311bc7ee976778
Author: Achim Gädke <[email protected]>
AuthorDate: Sun Jan 21 09:13:33 2024 +1300

    Run Trigger Page: Configurable number of recent configs (#36878)
    
    * Run Trigger Page: Configurable number of recent configs
    * no abbreviations in configuration names
---
 airflow/config_templates/config.yml | 7 +++++++
 airflow/www/views.py                | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/airflow/config_templates/config.yml 
b/airflow/config_templates/config.yml
index 3a53887b78..f6c0c09fc0 100644
--- a/airflow/config_templates/config.yml
+++ b/airflow/config_templates/config.yml
@@ -1875,6 +1875,13 @@ webserver:
       type: boolean
       example: ~
       default: "False"
+    num_recent_configurations_for_trigger:
+      description: |
+        Number of recent DAG run configurations in the selector on the trigger 
web form.
+      version_added: 2.9.0
+      type: integer
+      example: "10"
+      default: "5"
     allow_raw_html_descriptions:
       description: |
         A DAG author is able to provide any raw HTML into ``doc_md`` or params 
description in
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 16776f72da..7bb5b9854b 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -2029,6 +2029,7 @@ class Airflow(AirflowBaseView):
             flash(f"Cannot create dagruns because the dag {dag_id} has import 
errors", "error")
             return redirect(origin)
 
+        num_recent_confs = conf.getint("webserver", 
"num_recent_configurations_for_trigger")
         recent_runs = session.execute(
             select(DagRun.conf, func.max(DagRun.run_id).label("run_id"), 
func.max(DagRun.execution_date))
             .where(
@@ -2038,7 +2039,7 @@ class Airflow(AirflowBaseView):
             )
             .group_by(DagRun.conf)
             .order_by(func.max(DagRun.execution_date).desc())
-            .limit(5)
+            .limit(num_recent_confs)
         )
         recent_confs = {
             run_id: json.dumps(run_conf)

Reply via email to