Skip to content

Instantly share code, notes, and snippets.

@ChillarAnand
Created November 22, 2014 08:53
Show Gist options
  • Save ChillarAnand/f660e18ca4a4c13a8645 to your computer and use it in GitHub Desktop.
Save ChillarAnand/f660e18ca4a4c13a8645 to your computer and use it in GitHub Desktop.
celery periodic task example
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
Copy link

Shrhawk commented Feb 12, 2015

how to execute this ?

@ChillarAnand
Copy link
Author

@Shrhawk start celery worker with

celery worker -l info -A app.py --beat

@aqt01
Copy link

aqt01 commented Jul 1, 2016

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