Skip to content

Conversation

@bgrant
Copy link
Collaborator

@bgrant bgrant commented Jan 6, 2022

Replacing celery.task.task with celery.shared_task seems to fix the tests
on Celery 5 (they continue to work with Celery 4 as well).

I don't know enough about Celery to be sure this is the right fix, but
I'm going off of this:

If you’re using Django (see First steps with Django), or you’re the
author of a library then you probably want to use the shared_task()
decorator:

https://docs.celeryproject.org/en/stable/userguide/tasks.html

First steps with Django — Celery 5.2.3 documentation

@bgrant bgrant requested review from demianbrecht and dshafer January 6, 2022 18:42
@bgrant
Copy link
Collaborator Author

bgrant commented Jan 6, 2022

Fixes #80

@@ -1,5 +1,5 @@
Django~=2.2.0
celery>=4.0.2,<=4.4.0,!=4.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why 4.1.0 was excluded? I'd imagine that we ran into an issue with it at some point.

Copy link
Collaborator Author

@bgrant bgrant Jan 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the exclusion back 👍


import logging
from pydoc import locate
from celery.task import task as celery_task
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks shared_task has been around for ages. Curious as to why it wasn't originally used.

@smholloway smholloway merged commit dfc9742 into main Jan 18, 2022
@smholloway smholloway deleted the chore/upgrade-to-celery-5 branch January 18, 2022 17:24
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

Successfully merging this pull request may close these issues.

4 participants