BasPH commented on code in PR #76598:
URL: https://github.com/apache/airflow/pull/76598#discussion_r4510497376
##########
airflow-core/src/airflow/api_fastapi/core_api/services/ui/calendar.py:
##########
@@ -95,8 +92,26 @@ def _get_historical_dag_runs(
session: Session,
date_filter: RangeFilter,
granularity: Literal["hourly", "daily"],
- ) -> tuple[list[CalendarTimeRangeResponse], Sequence[Row]]:
- """Get historical Dag runs from the database."""
+ ) -> list[CalendarTimeRangeResponse]:
+ """
+ Fetch historical Dag runs.
+
+ :param dag_id: The Dag ID
+ :param session: Database session
+ :param date_filter: Filter for specific dates
+ :param granularity: hourly or daily
+ :return:
+ """
+ if date_filter.value:
+ lower_bounds = [
+ bound
+ for bound in (date_filter.value.lower_bound_gte,
date_filter.value.lower_bound_gt)
+ if bound is not None
+ ]
+ if lower_bounds and max(lower_bounds) > timezone.utcnow():
+ # The lower boundary is in the future, therefore skip
requesting historical dag runs.
+ return []
Review Comment:
I didn't take those into consideration, but will add.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]