Celery AttributeError: async error

后端 未结 6 1029
别那么骄傲
别那么骄傲 2021-01-31 13:50

I have RabbitMQ and Celery running locally on my Mac (OS/X 10.13.4), the following code works locally when I run add.delay(x,y):

#!/usr/bin/env python
from celer         


        
相关标签:
6条回答
  • 2021-01-31 14:15

    Make sure you are using Kombu 4.1.0. The latest version of Kombu renames async to asynchronous.

    0 讨论(0)
  • 2021-01-31 14:17

    pip install --upgrade 'celery>=4.2.0rc4'

    kombu==4.2.0 renames async to asynchronous, celery fixed it in celery==4.2.0rc4.

    So you should upgrade celery to 4.2.0rc4.

    refer: https://github.com/celery/celery/commit/c8ef7ad60b72a194654c58beb04a1d65cd0435ad

    0 讨论(0)
  • 2021-01-31 14:21

    We sorted by just updating to celery==4.1.1

    it seems the latest release for the 4.1.X sorted out the module name change on kombu

    0 讨论(0)
  • 2021-01-31 14:23

    That was the issue, it was in fact the kombu version.

    I managed to get 2 versions of kombu installed, 4.2.0 as the 'appuser' user, which I was trying to start the worker under, and 4.1.0 as 'root'. The 4.1.0 as 'root' would work, the other user did not.

    I removed kombu 4.2.0 from the 'appuser' user account (pip uninstall kombu as that user), so it would use the system-wide installed package, and the Celery worker operated correctly under that account.

    To verify that it is in fact kombu 4.2.0 that breaks, I removed the system-wide 4.1.0 version and let pip install the latest version, which it gets as 4.2.0, and the Celery worker would no longer start. I uninstalled it and forced pip to install 4.1.0 (pip install kombu==4.1.0) and the worker operated correctly.

    As another check I went to my Mac, where I originally wrote/tested this code, and checked the kombu version installed there by pip: 4.1.0. I'm not sure why pip on the Mac and Pi3 installed the 4.1.0 version of kombu while pip on the ODROID-C2 installed the 4.2.0 version. I'll dig more if I get a chance but it works now.

    0 讨论(0)
  • 2021-01-31 14:23

    A quick hack fix is to disable the result backend:

    # CELERY_RESULT_BACKEND = 'redis://redis'
    
    0 讨论(0)
  • 2021-01-31 14:29

    Celery does not pin its requirements for kombu and billiard to specific versions. They require the following:

    billiard>=3.5.0.2,<3.6.0
    kombu>=4.0.2,<5.0
    

    https://github.com/celery/celery/blob/v4.1.0/requirements/default.txt

    kombu 4.2.0 was released with a breaking change and previous versions of celery automatically install it.

    Since Celery doesn't pin specific versions, you should pin to the following if you will continue to use celery 4.1.0:

    kombu==4.1.0
    billiard==3.5.0.2
    
    0 讨论(0)
提交回复
热议问题