Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

result.get hangs if result backend not set #66

Closed
anuraguniyal opened this issue Aug 22, 2011 · 3 comments
Closed

result.get hangs if result backend not set #66

anuraguniyal opened this issue Aug 22, 2011 · 3 comments

Comments

@anuraguniyal
Copy link

Original problem:
I have two different django projects say projA and projB, each have its own celery daemon running on separate queues but same vhost, projA have a task taskA and projB have a task taskB, I try to run taskB from inside taskA e.g.

@task(routing_key='taskA')
def taskA(event_id):
    # do some work , then call taskB and wait for result
    result = send_task('taskB',routing_key='taskB')
    res = result.get(timeout=20)

I can see in logs of projB that taskB finished within a second, but taskA keeps on waiting for result and times out after 20 seconds

For backend I have rabbitmq.

Solution:
Setting the result back-end fixes the problem

CELERY_RESULT_BACKEND = "amqp"
CELERY_AMQP_TASK_RESULT_EXPIRES = 1000 

IMO if result back-end is not set result.get should throw error or at-least log a warning

@ask
Copy link
Contributor

ask commented Aug 23, 2011

Are you not using 2.3? This is the expected behaviour there:

>>> add.delay(2, 2).get()
Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/opt/devel/celery/celery/result.py", line 83, in get
        interval=interval)
    File "/opt/devel/celery/celery/backends/base.py", line 369, in _is_disabled
      raise NotImplementedError("No result backend configured.  "
NotImplementedError: No result backend configured.  Please see the documentation for more information.

@ask
Copy link
Contributor

ask commented Aug 23, 2011

Btw, you should not wait for tasks inside a task, see the Task user guide for information.

@anuraguniyal
Copy link
Author

yes I have read that, but sometime asynchronous callbacks makes simple tasks really complex

I am using 2.2.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants