Celery Received unregistered task of type (run example)

后端 未结 30 1846
旧时难觅i
旧时难觅i 2020-11-28 04:42

I\'m trying to run example from Celery documentation.

I run: celeryd --loglevel=INFO

/usr/local/lib/python2.7/dist-packages/celery/loade         


        
相关标签:
30条回答
  • 2020-11-28 05:20

    The solution for me to add this line to /etc/default/celeryd

    CELERYD_OPTS="-A tasks"
    

    Because when I run these commands:

    celery worker --loglevel=INFO
    celery worker -A tasks --loglevel=INFO
    

    Only the latter command was showing task names at all.

    I have also tried adding CELERY_APP line /etc/default/celeryd but that didn't worked either.

    CELERY_APP="tasks"
    
    0 讨论(0)
  • 2020-11-28 05:21

    I encountered this problem as well, but it is not quite the same, so just FYI. Recent upgrades causes this error message due to this decorator syntax.

    ERROR/MainProcess] Received unregistered task of type 'my_server_check'.

    @task('my_server_check')

    Had to be change to just

    @task()

    No clue why.

    0 讨论(0)
  • 2020-11-28 05:22

    An additional item to a really useful list.

    I have found Celery unforgiving in relation to errors in tasks (or at least I haven't been able to trace the appropriate log entries) and it doesn't register them. I have had a number of issues with running Celery as a service, which have been predominantly permissions related.

    The latest related to permissions writing to a log file. I had no issues in development or running celery at the command line, but the service reported the task as unregistered.

    I needed to change the log folder permissions to enable the service to write to it.

    0 讨论(0)
  • 2020-11-28 05:23

    Whether you use CELERY_IMPORTS or autodiscover_tasks, the important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch.

    When you launch the Celery, say celery worker -A project --loglevel=DEBUG, you should see the name of the tasks. For example, if I have a debug_task task in my celery.py.

    [tasks]
    . project.celery.debug_task
    . celery.backend_cleanup
    . celery.chain
    . celery.chord
    . celery.chord_unlock
    . celery.chunks
    . celery.group
    . celery.map
    . celery.starmap
    

    If you can't see your tasks in the list, please check your celery configuration imports the tasks correctly, either in --setting, --config, celeryconfig or config_from_object.

    If you are using celery beat, make sure the task name, task, you use in CELERYBEAT_SCHEDULE matches the name in the celery task list.

    0 讨论(0)
  • 2020-11-28 05:24

    If you are running into this kind of error, there are a number of possible causes but the solution I found was that my celeryd config file in /etc/defaults/celeryd was configured for standard use, not for my specific django project. As soon as I converted it to the format specified in the celery docs, all was well.

    0 讨论(0)
  • 2020-11-28 05:24

    The answer to your problem lies in THE FIRST LINE of the output you provided in your question: /usr/local/lib/python2.7/dist-packages/celery/loaders/default.py:64: NotConfigured: No 'celeryconfig' module found! Please make sure it exists and is available to Python. "is available to Python." % (configname, ))). Without the right configuration Celery is not able to do anything.

    Reason why it can't find the celeryconfig is most likely it is not in your PYTHONPATH.

    0 讨论(0)
提交回复
热议问题