-
-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency on celery lacks documentation #1114
Comments
Thanks for this report. Can you submit a PR which would fix this? |
The django-oauth-toolkit accidentally introduced a dependency on celery in v1.7.0: jazzband/django-oauth-toolkit#1114 We can remove the dependency, as soon as the issue is fixed.
To be honest, I cannot tell, what the original commit is supposed to do exactly. I think, it is supposed to wrap the function in order to enforce its execution in a task queue. In huey there are two types of function decorators:
The original commit, which introduced the In this case I do not understand the purpose of the current snippet. Maybe there is something missing? @Natureshadow: maybe you could clarify, how exactly your addition should be used? |
To unblock everyone trying to upgrade to 1.7.0, could you maybe just state celery as dependency in your |
That depends on what scheduler you use with Celery.
I don't think so.
This is described in the original PR and in the Celery documentation linked from there and from the DOT docs. |
Thank you for helping to solve this issue!
Thank you.
My understanding of the above documentation is, that the Sorry for me trying to be precise here, but even after going through your PR and the referenced parts of the celery documentation multiple times, I fail to grasp the exact effect of this decorated function. I hope, that your answer to my above question will clarify this for me. Thank you! |
My understanding of the above documentation is, that the *clear_tokens* function is just decorated for being executed via celery. But I am quite confident, that this does not involve any /scheduling/ (e.g. "call this function every Friday at midnight"). Thus the user needs to arrange the execution of *clear_tokens* somehow (e.g. calling it explicitly or specifying an execution period).
Is this correct?
Sorry for me trying to be precise here, but even after going through your PR and the referenced parts of the celery documentation multiple times, I fail to grasp the /exact/ effect of this decorated function. I hope, that your answer to my above question will clarify this for me.
Yes, you need to use some scheduler and configure celery-beat to use it, or trigger the task in any other way.
|
@MichaelVoelkel said:
My understanding is that this decorator does not add a dependency on celery and that it is only inadvertently a problem if you are using huey as described by @sumpfralle since it also looks for a tasks.py So this is not blocking everyone from upgrading and is only a conflict for those using huey. Meanwhile, a PR that resolves the conflict between huey and celery both autoloading tasks.py would be greatly appreciated by someone who is familiar with them. Perhaps a test in tasks.py to do a conditional import? Or perhaps a setting that avoids the autoloading confict? |
Okay, sorry, but I do not get this. Within the codebase of this package, you import But is this really your quality approach? Do not mention dependencies that might not be used be a library user? |
Describe the bug
Recently (commit a6a21d3) a dependency on celery was introduced. Probably it was meant to be triggered only, if celery is active (which would cause the import of
tasks.py
). But in reality it is also triggered, if other task queue handlers are running (in my case: huey).To Reproduce
Add
oauth2_provider
andhuey
toINSTALLED_APPS
and ensure, that thecelery
module is not available.python3 manage.py runserver
will fail due to the missingcelery
module.Expected behavior
I could imagine the following behaviors to be more desirable:
celery
module is silently ignoredcelery
is only imported, ifcelery
is found insettings.INSTALLED_APPS
celery
orhuey
) is detected (e.g. by inspectingsettings.INSTALLED_APPS
) and the relevant decorator is selectedVersion
1.7.0
Additional context
The text was updated successfully, but these errors were encountered: