예제 #1
0
 def handle(self, *args, **options):
     try:
         scheduler = PersistentScheduler(
             schedule_filename=settings.CELERY_BEAT_SCHEDULE_FILENAME,
             app=app
         )
         scheduler.setup_schedule()
     except Exception as error:
         self.stderr.write(
             'Removing corrupted schedule file: {:r}'.format(error)
         )
         scheduler._remove_db()
예제 #2
0
 def handle(self, *args, **options):
     try:
         scheduler = PersistentScheduler(
             schedule_filename=settings.CELERY_BEAT_SCHEDULE_FILENAME,
             app=app)
         scheduler.setup_schedule()
     except Exception as error:
         self.stderr.write(
             'Removing corrupted schedule file: {!r}'.format(error))
         self.try_remove(settings.CELERY_BEAT_SCHEDULE_FILENAME)
         self.try_remove(settings.CELERY_BEAT_SCHEDULE_FILENAME + '.db')
         scheduler = PersistentScheduler(
             schedule_filename=settings.CELERY_BEAT_SCHEDULE_FILENAME,
             app=app)
         scheduler.setup_schedule()
예제 #3
0
"""
查询定时任务调度的数据
"""

import shelve

from celery.beat import PersistentScheduler

from apps.task import celery
from apps.task.settings import beat_schedule_filename

# with shelve.open(beat_schedule_filename) as db:
#     print(db)
#     print(db['entries'])

persistent_scheduler = PersistentScheduler(
    app=celery, schedule_filename=beat_schedule_filename)


def get_schedule():
    return persistent_scheduler.get_schedule()


def set_schedule():
    persistent_scheduler.set_schedule()


def add_schedule():
    persistent_scheduler.add()


if __name__ == "__main__":
예제 #4
0
 def __init__(self, *args, **kwargs):
     app = kwargs['app']
     self.persistence = RedisShelve(app.backend.client)
     PersistentScheduler.__init__(self, *args, **kwargs)
예제 #5
0
 def __init__(self, *args, **kwargs):
     self.Entry = LimitedEntry
     PersistentScheduler.__init__(self, *args, **kwargs)