From 0b9a4f5349426969d8c0a79649e701e386a1ee30 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Wed, 31 Jul 2024 16:07:54 -0700 Subject: [PATCH] fix: set timezone for utc datetime in scheduler --- superset/tasks/scheduler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset/tasks/scheduler.py b/superset/tasks/scheduler.py index df8c3c1c4f168..652d556e8909b 100644 --- a/superset/tasks/scheduler.py +++ b/superset/tasks/scheduler.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. import logging -from datetime import datetime +from datetime import datetime, timezone from celery import Celery from celery.exceptions import SoftTimeLimitExceeded @@ -50,7 +50,7 @@ def scheduler() -> None: datetime.fromisoformat(scheduler.request.expires) - app.config["CELERY_BEAT_SCHEDULER_EXPIRES"] if scheduler.request.expires - else datetime.utcnow() + else datetime.now(tz=timezone.utc) ) for active_schedule in active_schedules: for schedule in cron_schedule_window(