Skip to content

Commit

Permalink
Refactor: Simplify code in www (#33270)
Browse files Browse the repository at this point in the history
  • Loading branch information
eumiro authored Aug 10, 2023
1 parent 7c950a8 commit 369b9bc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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]

Expand Down

0 comments on commit 369b9bc

Please sign in to comment.