You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2023/02/14 17:06:37 UTC
[airflow] branch main updated: Make `prev_logical_date` variable offset-aware (#29454)
This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new f837c0105c Make `prev_logical_date` variable offset-aware (#29454)
f837c0105c is described below
commit f837c0105c85d777ea18c88a9578eeeeac5f57db
Author: Arkadiy Krava <ar...@ex.ua>
AuthorDate: Tue Feb 14 19:06:09 2023 +0200
Make `prev_logical_date` variable offset-aware (#29454)
* Make `prev_logical_date` variable offset-aware
* Test Calendar page for DAG with non-cron like schedule
* Use pendulum DateTime.min which is offset-aware
---
airflow/www/views.py | 2 +-
tests/www/views/test_views_tasks.py | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/airflow/www/views.py b/airflow/www/views.py
index ee0277651f..a1c8b2cb03 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -2866,7 +2866,7 @@ class Airflow(AirflowBaseView):
break
dates[dt.date()] += 1
else:
- prev_logical_date = datetime.min
+ prev_logical_date = DateTime.min
while True:
curr_info = dag.timetable.next_dagrun_info(
last_automated_data_interval=last_automated_data_interval,
diff --git a/tests/www/views/test_views_tasks.py b/tests/www/views/test_views_tasks.py
index cc8366dee2..68ccff62cd 100644
--- a/tests/www/views/test_views_tasks.py
+++ b/tests/www/views/test_views_tasks.py
@@ -87,6 +87,14 @@ def init_dagruns(app, reset_dagruns):
start_date=timezone.utcnow(),
state=State.RUNNING,
)
+ app.dag_bag.get_dag("latest_only").create_dagrun(
+ run_id=DEFAULT_DAGRUN,
+ run_type=DagRunType.SCHEDULED,
+ execution_date=DEFAULT_DATE,
+ data_interval=(DEFAULT_DATE, DEFAULT_DATE),
+ start_date=timezone.utcnow(),
+ state=State.RUNNING,
+ )
yield
clear_db_runs()
@@ -266,6 +274,11 @@ def client_ti_without_dag_edit(app):
["example_bash_operator"],
id="existing-dagbag-calendar",
),
+ pytest.param(
+ "dags/latest_only/calendar",
+ ["latest_only"],
+ id="existing-dagbag-non-cron-schedule-calendar",
+ ),
pytest.param(
"dag_details?dag_id=example_bash_operator",
["example_bash_operator"],