标签:parent 创建 代码 结果 ret shell get conf task
from celery import Celery
app = Celery(‘tasks‘, backend=‘amqp‘, broker=‘amqp://guest@localhost:5672//‘)
@app.task
def add(x, y):
return x + y
from task2 import add
result = add.delay(1,1)
import time
while not result.ready():
print(‘not yet ready‘)
time.sleep(1)
print(result.get())
celery -A task2.app worker --loglevel=info
标签:parent 创建 代码 结果 ret shell get conf task
原文地址:http://www.cnblogs.com/George1994/p/7385335.html