Skip to content

Instantly share code, notes, and snippets.

@sotsugov
Forked from alexanderjulo/celery-crontab.py
Last active August 29, 2015 14:28
Show Gist options
  • Save sotsugov/56e8a0c59bea4708ee97 to your computer and use it in GitHub Desktop.
Save sotsugov/56e8a0c59bea4708ee97 to your computer and use it in GitHub Desktop.
celery crontab example
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