From d2e2368cb97368cb9f9a6f7490f225e85731362c Mon Sep 17 00:00:00 2001 From: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Date: Sun, 8 Oct 2023 07:24:32 -0600 Subject: [PATCH] Add debug log saying whats being run to `EventScheduler` (#34808) It can be difficult to debug issues in things the EventScheduler runs, especially if they don't log anything meaningful themselves. A simple "Hey, I'm going to run x" debug level log is very useful. --- airflow/utils/event_scheduler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/airflow/utils/event_scheduler.py b/airflow/utils/event_scheduler.py index f234be4ace35b..9eaca6ed905a0 100644 --- a/airflow/utils/event_scheduler.py +++ b/airflow/utils/event_scheduler.py @@ -20,8 +20,10 @@ from sched import scheduler from typing import Callable +from airflow.utils.log.logging_mixin import LoggingMixin -class EventScheduler(scheduler): + +class EventScheduler(scheduler, LoggingMixin): """General purpose event scheduler.""" def call_regular_interval( @@ -34,6 +36,7 @@ def call_regular_interval( """Call a function at (roughly) a given interval.""" def repeat(*args, **kwargs): + self.log.debug("Calling %s", action) action(*args, **kwargs) # This is not perfect. If we want a timer every 60s, but action # takes 10s to run, this will run it every 70s.