yuseok89 commented on code in PR #76598:
URL: https://github.com/apache/airflow/pull/76598#discussion_r4500472642
##########
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:
It looks like the lookup is intentionally skipped for future date ranges.
Technically, a manual trigger can still leave a Dag run with a future logical
date in running, while its tasks wait for that date. Should these existing runs
also be excluded from the calendar?
--
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]