Created
August 26, 2015 21:52
-
-
Save ThrowsException/f65981f2e15bc12c2930 to your computer and use it in GitHub Desktop.
Simple celery app with mongodb
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 import Celery | |
CELERY_BROKER_URL = 'redis://127.0.0.1:6379' | |
app = Celery('tasks', broker=CELERY_BROKER_URL) | |
app.conf.update( | |
CELERY_TASK_SERIALIZER='json', | |
CELERY_ACCEPT_CONTENT=['json'], | |
CELERY_RESULT_SERIALIZER='json', | |
CELERY_MONGODB_SCHEDULER_DB = "celery", | |
CELERY_MONGODB_SCHEDULER_COLLECTION = "schedules", | |
CELERY_MONGODB_SCHEDULER_URL = "mongodb://10.0.2.2", | |
CELERY_BROKER_URL = 'redis://127.0.0.1:6379', | |
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379' | |
) | |
@app.task | |
def add(): | |
print "yay" | |
return "yay" |
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
{ | |
"_id" : ObjectId("533c5b29b45a2092bffceb13"), | |
"name" : "celery_mongo.add", | |
"task" : "celery_mongo.add", | |
"enabled" : true, | |
"interval" : { | |
"every" : 10, | |
"period" : "seconds" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What's in the logs?