I'm a totally new user using Celery in python. Here are my notes:
My celery_test.py file:
from celery import Celery
import time
app = Celery('tasks', broker='amqp://guest@localhost//')
@app.task
def add(x, y):
time.sleep(5)
return x + y
import time
app = Celery('tasks', broker='amqp://guest@localhost//')
@app.task
def add(x, y):
time.sleep(5)
return x + y
celery -A celery_test worker --loglevel=info
>>> from celery_test import *
>>> add.delay(100, 200)
By the way:After modifying the add function, I had to update Celery by killing this process and running it again:
celery -A celery_test worker --loglevel=info
celery -A celery_test worker --loglevel=info
No comments:
Post a Comment