This is an automated email from the ASF dual-hosted git repository.
potiuk 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 369b9bc947 Refactor: Simplify code in www (#33270)
369b9bc947 is described below
commit 369b9bc947215d396570b06c3a5e7b982f234e76
Author: Miroslav Šedivý <[email protected]>
AuthorDate: Thu Aug 10 10:48:09 2023 +0000
Refactor: Simplify code in www (#33270)
---
airflow/www/views.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 5f12a94969..1e61432c9f 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -3251,8 +3251,7 @@ class Airflow(AirflowBaseView):
y=scale_time_units(cumulative_y[task_id], cum_y_unit),
)
- dates = sorted({ti.execution_date for ti in task_instances})
- max_date = max(ti.execution_date for ti in task_instances) if dates
else None
+ max_date = max((ti.execution_date for ti in task_instances),
default=None)
session.commit()
@@ -3350,8 +3349,7 @@ class Airflow(AirflowBaseView):
if x_points:
chart.add_serie(name=task.task_id, x=x_points, y=y_points)
- tries = sorted({ti.try_number for ti in tis})
- max_date = max(ti.execution_date for ti in tis) if tries else None
+ max_date = max((ti.execution_date for ti in tis), default=None)
chart.create_y_axis("yAxis", format=".02f", custom_format=False,
label="Tries")
chart.axislist["yAxis"]["axisLabelDistance"] = "-15"
@@ -3874,7 +3872,7 @@ class Airflow(AirflowBaseView):
updated_before =
_safe_parse_datetime(request.args.get("updated_before"), allow_empty=True)
# Check and clean up query parameters
- limit = 50 if limit > 50 else limit
+ limit = min(50, limit)
uri_pattern = uri_pattern[:4000]