I am trying to run the Celery example on Windows with backis. The code looks like this:
from celery import Celery app = Celery('risktools.distributed.celery_tasks', backend='redis://localhost', broker='redis://localhost') @app.task(ignore_result=False) def add(x, y): return x + y @app.task(ignore_result=False) def add_2(x, y): return x + y
I run tasks using the iPython console:
>>> result_1 = add.delay(1, 2) >>> result_1.state 'PENDING' >>> result_2 = add_2.delay(2, 3) >>> result_2.state 'PENDING'
It seems that both tasks were not completed, but the Celery desktop shows that they succeeded:
[2014-12-08 15:00:09,262: INFO/MainProcess] Received task: risktools.distributed.celery_tasks.add[01dedca1-2db2-48df-a4d6-2f06fe285e45] [2014-12-08 15:00:09,267: INFO/MainProcess] Task celery_tasks.add[01dedca1-2db2-48df-a4d6-2f06fe28 5e45] succeeded in 0.0019998550415s: 3 [2014-12-08 15:00:24,219: INFO/MainProcess] Received task: risktools.distributed.celery_tasks.add[cb5505ce-cf93-4f5e-aebb-9b2d98a11320] [2014-12-08 15:00:24,230: INFO/MainProcess] Task celery_tasks.add[cb5505ce-cf93-4f5e-aebb-9b2d98a1 1320] succeeded in 0.010999917984s: 5
I tried to fix this problem according to the celery documentation , but none of the tips were helpful. What am I doing wrong, and how can I get results on a celery assignment?
UPD: I added a task without ignore_result parameter, but nothing has changed
@app.task def add_3(x, y): return x + y >>>r = add_3.delay(2, 2) >>>r.state 'PENDING'
source share