Skip to content

Instantly share code, notes, and snippets.

@skillachie
Created June 15, 2013 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skillachie/5789085 to your computer and use it in GitHub Desktop.
Save skillachie/5789085 to your computer and use it in GitHub Desktop.
Celery and MongoDB
from celery import Celery
import time
#Specify mongodb host and datababse to connect to
BROKER_URL = 'mongodb://localhost:27017/jobs'
celery = Celery('EOD_TASKS',broker=BROKER_URL)
#Loads settings for Backend to store results of jobs
celery.config_from_object('celeryconfig')
@celery.task
def add(x, y):
time.sleep(30)
return x + y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment