Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions django_celery_beat/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,3 +523,25 @@ def schedule(self):
repr(entry) for entry in self._schedule.values()),
)
return self._schedule


class DryRunDatabaseScheduler(DatabaseScheduler):
"""
DatabaseScheduler in dry-run mode.

The Scheduler reads Periodic Tasks from the database but does not execute them,
only logging when they would have been triggered.
Useful in environments where tasks should not actually run, but the scheduler
must remain operational.
"""

def apply_entry(self, entry, producer=None):
"""
Overwritten method to log the triggered tasks instead of actually running it.
"""
debug(
'Dry-run mode: Skipping task %s %s %s',
entry.task,
entry.args,
entry.kwargs
)