Celery does not return results

For some reason, whenever I create and launch a new Task in Celery, there is a problem with returning the results. The first task returns fine, but for all subsequent tasks the result is always expecting. I checked the celery journal and it got the correct result without errors, but it just can't return it.

If this helps, I run rabbitmq as my backend.

+7
python celery rabbitmq
source share
2 answers

Well, it turns out I just need to explicitly specify the backend.

Addendum:

CELERY_RESULT_BACKEND = "amqp" 

My settings file seemed to fix everything.

+5
source share

I also get the same problem even if I add the amqp backend.

Here is my celery configuration file:

 BROKER_HOST = "localhost" BROKER_PORT = 5672 BROKER_USER = "guest" BROKER_PASSWORD = "guest" BROKER_VHOST = "/" CELERY_RESULT_BACKEND = "amqp" CELERY_AMQP_TASK_RESULT_EXPIRES = 18000 # 5 hours. CELERY_IMPORTS = ("test", ) 

My shell, where the first time gets success, the second time it hangs. Someday, if I call the method again, it will work. This pattern continues to repeat.

 >>> r = test.add.delay(4, 4) >>> r.get() 8 >>> r = test.add.delay(4, 4) >>> r.get() ^C <---------- it was hung here forever, I had to press ^C >>> r = test.add.delay(4, 4) >>> r.get() 8 
+1
source share

All Articles