Celery worker hangs without any error

后端 未结 3 1982
梦如初夏
梦如初夏 2021-01-31 06:06

I have a production setup for running celery workers for making a POST / GET request to remote service and storing result, It is handling load around 20k tasks per 15 min.

3条回答
  •  隐瞒了意图╮
    2021-01-31 06:52

    I also faced the issue, when I was using delay shared_task with celery, kombu, amqp, billiard. After calling the API when I used delay() for @shared_task, all functions well but when it goes to delay it hangs up.

    So, the issue was In main Application init.py, the below settings were missing

    This will make sure the app is always imported when # Django starts so that shared_task will use this app.

    In init.py

    from __future__ import absolute_import, unicode_literals
    
    # This will make sure the app is always imported when
    # Django starts so that shared_task will use this app.
    from .celery import app as celeryApp
    
    #__all__ = ('celeryApp',)
    __all__ = ['celeryApp']
        
    

    Note1: In place of celery_app put the Aplication name, means the Application mentioned in celery.py import the App and put here

    Note2:** If facing only hangs issue in shared task above solution may solve your issue and ignore below matters.

    Also wanna mention A=another issue, If anyone facing Error 111 connection issue then please check the versions of amqp==2.2.2, billiard==3.5.0.3, celery==4.1.0, kombu==4.1.0 whether they are supporting or not. Mentioned versions are just an example. And Also check whether redis is install in your system(If any any using redis).

    Also make sure you are using Kombu 4.1.0. In the latest version of Kombu renames async to asynchronous.

提交回复
热议问题