[AIRFLOW-1853] Show only the desired number of runs in tree view Previously, the "Number of runs" option was not being respected for DAGs that were externally triggered. Now, only the set number of runs is shown regardless of DAG trigger type.
Also adjust www_rbac Closes #3288 from AetherUnbound/feature/AIRFLOW-1853 Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/2d1b2aee Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/2d1b2aee Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/2d1b2aee Branch: refs/heads/v1-10-test Commit: 2d1b2aee91bc47cfe48a470e1618f026ece86a4d Parents: a67c13e Author: Matthew Bowden <[email protected]> Authored: Tue May 1 22:03:24 2018 +0200 Committer: Fokko Driesprong <[email protected]> Committed: Tue May 1 22:03:24 2018 +0200 ---------------------------------------------------------------------- airflow/www/views.py | 4 ++++ airflow/www_rbac/views.py | 4 ++++ 2 files changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/2d1b2aee/airflow/www/views.py ---------------------------------------------------------------------- diff --git a/airflow/www/views.py b/airflow/www/views.py index 5dda036..ff24031 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -1254,6 +1254,10 @@ class Airflow(BaseView): dr.execution_date: alchemy_to_dict(dr) for dr in dag_runs} dates = sorted(list(dag_runs.keys())) + # Only show the desired number of runs regardless of the trigger method + if len(dates) > num_runs: + dates = dates[-num_runs:] + max_date = max(dates) if dates else None tis = dag.get_task_instances( http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/2d1b2aee/airflow/www_rbac/views.py ---------------------------------------------------------------------- diff --git a/airflow/www_rbac/views.py b/airflow/www_rbac/views.py index f064c14..9636a58 100644 --- a/airflow/www_rbac/views.py +++ b/airflow/www_rbac/views.py @@ -894,6 +894,10 @@ class Airflow(AirflowBaseView): dr.execution_date: alchemy_to_dict(dr) for dr in dag_runs} dates = sorted(list(dag_runs.keys())) + # Only show the desired number of runs regardless of the trigger method + if len(dates) > num_runs: + dates = dates[-num_runs:] + max_date = max(dates) if dates else None tis = dag.get_task_instances(
