bbovenzi commented on code in PR #68682:
URL: https://github.com/apache/airflow/pull/68682#discussion_r3624441835
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -572,8 +588,33 @@ def get_dag_runs(
query = select(DagRun).options(*eager_load_dag_run_for_list())
if dag_id != "~":
- get_latest_version_of_dag(dag_bag, dag_id, session) # Check if the
Dag exists.
+ dag = get_latest_version_of_dag(dag_bag, dag_id, session) # Check if
the Dag exists.
query = query.filter(DagRun.dag_id == dag_id).options()
+ if partition_date_start is not None or partition_date_end is not None:
+ # The bounds are calendar days, so the whole of partition_date_end
belongs to the
+ # window: widen it to the following local midnight and exclude
that edge.
+ query = DagRun.apply_partition_date_window(
+ query,
+ timetable=dag.timetable,
+ start=(
+ datetime.datetime.combine(partition_date_start,
datetime.time.min)
+ if partition_date_start is not None
+ else None
+ ),
+ end=(
+ datetime.datetime.combine(
+ partition_date_end + datetime.timedelta(days=1),
datetime.time.min
+ )
+ if partition_date_end is not None
+ else None
+ ),
+ end_exclusive=True,
+ )
+ elif partition_date_start is not None or partition_date_end is not None:
Review Comment:
We're repeating the same if condition here and in line 593 but with
different results. It is hard to understand at a glance. Let's rearrange our if
statements to be more readable.
--
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]