1. 介绍
Celery非常容易设置,通常都是使用默认的queue来存放任务,写法如下:
@app.task
def task1(x, y):
for _ in range(10):
time.sleep(1)
print('x + y =', x + y)
return x + y
@app.task
def task2():
for _ in range(100):
print('task2: ', datetime.now())
time.sleep(1)