Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2029,6 +2029,7 @@ def trigger(self, dag_id: str, session: Session = NEW_SESSION):
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(
Expand All @@ -2038,7 +2039,7 @@ def trigger(self, dag_id: str, session: Session = NEW_SESSION):
)
.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)
Expand Down