diff --git a/airflow/www/views.py b/airflow/www/views.py index 5f12a9496914..1e61432c9fcb 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -3251,8 +3251,7 @@ def duration(self, dag_id: str, session: Session = NEW_SESSION): 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 @@ def tries(self, dag_id: str, session: Session = NEW_SESSION): 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 @@ def datasets_summary(self): 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]