This is an automated email from the ASF dual-hosted git repository.

husseinawala 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 d2e2368cb9 Add debug log saying whats being run to `EventScheduler` 
(#34808)
d2e2368cb9 is described below

commit d2e2368cb97368cb9f9a6f7490f225e85731362c
Author: Jed Cunningham <[email protected]>
AuthorDate: Sun Oct 8 07:24:32 2023 -0600

    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 f234be4ace..9eaca6ed90 100644
--- a/airflow/utils/event_scheduler.py
+++ b/airflow/utils/event_scheduler.py
@@ -20,8 +20,10 @@ from __future__ import annotations
 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 @@ class EventScheduler(scheduler):
         """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.

Reply via email to