Skip to content

Commit

Permalink
Add debug log saying whats being run to EventScheduler (#34808)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jedcunningham committed Oct 8, 2023
1 parent d4de5c3 commit d2e2368
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion airflow/utils/event_scheduler.py
Expand Up @@ -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(
Expand All @@ -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.
Expand Down

0 comments on commit d2e2368

Please sign in to comment.