Skip to content
New issue

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

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

Already on GitHub? # to your account

Celery breaks upgrading from 4.4.6 to 4.4.7 #2827

Closed
jskitz opened this issue Sep 14, 2020 · 3 comments · Fixed by #2829
Closed

Celery breaks upgrading from 4.4.6 to 4.4.7 #2827

jskitz opened this issue Sep 14, 2020 · 3 comments · Fixed by #2829
Labels

Comments

@jskitz
Copy link

jskitz commented Sep 14, 2020

What happened?

The requirements in Django Cookie Cutter changed Celery from 4.4.6 to 4.4.7 recently. I upgraded my projects that were based off of this project, and then I could no longer get my tasks to be pulled in to production. There is more on this issue in Celery issues

What should've happened instead?

Production tasks should have been properly registered as tasks. Instead, when you invoke tasks in production, it says that there are no registered tasks. This can be verified by running celery from an init.d script, opening a shell on production, and executing the following tasks:

from celery.task.control import  inspect
i = inspect()
i.registered_tasks()

Additional details

  • Host system configuration:

    • Celery is run on ubuntu via an init script generating a command like the following: celery -c /home/ubuntu/venv/bin/celery multi start w1 --workdir=/home/ubuntu/project --pidfile=/var/run/celery/%n.pid --logfile=/var/log/celery/%n%I.log --loglevel=INFO --app=config.celery_app --time-limit=300 --concurrency=4. This will not pass the --app=config.celery_app to the workers.
    • Version of cookiecutter CLI (get it with cookiecutter --version): 1.7.2
    • OS: Problem happens using production settings but not local settings.
    • Python version: 3.8
    • Docker versions (if using Docker): N/A
  • Options selected and/or replay file: Choosing Celery with the latest build of django-cookiecutter will use 4.4.7 instead 4.4.6 which exhibits the problem.

The solution is simply to downgrade to Celery 4.4.6 until Celery pushes out a new version. Posting here to save other people a lot of time and headaches trying to debug what was happening with this recent upgrade.

@jskitz jskitz added the bug label Sep 14, 2020
@jskitz jskitz changed the title Celery breaks upgrading from 4.4.6 to 4.4.7 [bug] Celery breaks upgrading from 4.4.6 to 4.4.7 Sep 14, 2020
@browniebroke
Copy link
Member

browniebroke commented Sep 14, 2020

I saw this issue in Celery a few days ago, but didn't get around to fix it here. We should definitely downgrade if it's affecting us.

@Andrew-Chen-Wang
Copy link
Contributor

Andrew-Chen-Wang commented Oct 2, 2020

Actually this is pretty interesting. The fix is using CELERY_APP as an environment variable, according to that repo, for now (which happens to be in the entrypoint file) since I didn't realize that my celery 4.4.7 on Docker was working fine. This may just be a local setup issue.

Although tbf, I've been having all sorts of issues lately with Celery > 4.4.2 after some string of commits messed up the celery multi command which ended up messing up a lot of things afterwards.

@arnav13081994
Copy link
Contributor

@Andrew-Chen-Wang I think you're right about that. All those inspect tasks fail to be registered iff flower gets started before celery. Somehow that wasn't an issue before 4.4.6 perhaps because of that env var you mention but I have no idea about that.

To resolve the issue, I added a custom script that waits for 1 or more celery workers to be online and only then the flower service gets started. And so far everything seems to be working fine.

Also, celery 5.0.0 has quite a few breaking changes ....

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

Successfully merging a pull request may close this issue.

4 participants