Skip to content

Instantly share code, notes, and snippets.

@voith
Created June 6, 2023 12:16
Show Gist options
  • Save voith/66c82bd73c22af8d421f29939fed9e33 to your computer and use it in GitHub Desktop.
Save voith/66c82bd73c22af8d421f29939fed9e33 to your computer and use it in GitHub Desktop.
Script to run redbeat tasks
from collections import namedtuple
from rebate_program.celery import app # get the celery app object from your project
from redbeat.schedulers import RedBeatScheduler, acquire_distributed_beat_lock
beat = RedBeatScheduler(app)
Sender = namedtuple('sender', ['scheduler'])
sender = Sender(beat)
acquire_distributed_beat_lock(sender)
print(beat.schedule)
# run schduler taks
beat.tick()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment