Created
November 22, 2014 08:53
-
-
Save ChillarAnand/f660e18ca4a4c13a8645 to your computer and use it in GitHub Desktop.
celery periodic task 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 datetime import timedelta | |
from celery import Celery | |
from celery.task import periodic_task | |
app = Celery('tasks', backend='amqp', | |
broker='amqp://guest@localhost//') | |
@periodic_task(run_every=timedelta(seconds=10)) | |
def a(): | |
return ' i running periodic task ' |
@Shrhawk start celery worker with
celery worker -l info -A app.py --beat
what if i want to parametrize the crontab or timedelta?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to execute this ?