-
-
Save sotsugov/56e8a0c59bea4708ee97 to your computer and use it in GitHub Desktop.
celery crontab example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.schedules import crontab | |
from flask.ext.celery import Celery | |
CELERYBEAT_SCHEDULE = { | |
# executes every night at 4:15 | |
'every-night': { | |
'task': 'user.checkaccounts', | |
'schedule': crontab(hour=4, minute=20) | |
} | |
} | |
celery = Celery(www) | |
@celery.task(name='user.checkaccounts') | |
def checkaccounts(): | |
# do something | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment