Comments (8)
Are you sure? A downgrade to Django 1.5.4 did not remove the error for me, and this project's tests pass with Django 1.5.5.
Here is more info: The error occurs at https://github.com/ui/django-rq/blob/master/django_rq/queues.py#L68 where there is a comment
# We're using django-redis-cache
return cache._client
But I am not: I am using django-redis
. So perhaps the test of if hasattr(cache, 'client'):
has gotten stale.
from django-rq.
I realize that the CacheStatTracker
does not occur in the Django, django-rq, or django-redis projects.
>>> from django.core.cache import cache
>>> cache.__class__
<class 'debug_toolbar.panels.cache.CacheStatTracker'>
It is from the Django debug toolbar. @Koed00 are you also using the debug toolbar?
from django-rq.
@kennknowles Yes, using django-redis==3.3
and django-debug-toolbar==0.9.4
. Since I downgraded with my requirements.txt I'm guessing it could be a problem with debug-toolbar 0.10.2
from django-rq.
The problem seems to be that debug-toolbar monkey patches django.core.cache.get_cache
to always return CacheStatTracker
which inherits directly from BaseCache
, instead of the currently used cache backend (django-redis
in your case).
I'm closing this issue because the is a bug in django-debug-toolbar
as opposed to django-rq
. Please let me know if my analysis is wrong and I'll reopen this issue.
from django-rq.
It is not a bug in django-debug-toolbar
: The CacheStatTracker
implements the django cache interface.
The "bug" is that django-rq
depends on implementation details of django-redis
and django-redis-cache
which are not really part of django's cache interface, so sometimes even when another library is correct, it will cause django-rq
to crash. This seems to happen rarely, so I am not saying that this is so bad.
Anyhow, it is built in to the design decision to leverage the cache framework (how else are you going to get a redis client out of the cache implementation other than looking at its internals?) so the only obvious solution is to remove this. If you feel it is worth tracking, I suggest opening a new ticket for the design bug.
from django-rq.
It's true that django-debug-toolbar
implements Django's cache interface, but so does django-redis
;).
Instead of always subclassing BaseCache
when monkey patching the cache module, do you think it's possible to subclass the current, user defined cache class instead? This should allow CacheStatTracker
to preserve the attributes of its superclass.
I haven't had the time to test this out or think too deeply about this though, but I still think the monkey patching is the cause of the problem ;).
Thoughts?
from django-rq.
Well, as long as we are looking at basically private members of Cache
subclasses, it is not any worse to check for one more case and handle it, something like this just before the client
vs _client
check:
if cache.__class__.__name__ == 'CacheStatTracker':
cache = cache.cache
In the short term, you can also remove the cache stats from the debug panel, something like so:
DEBUG_TOOLBAR_PANELS = [
# 'debug_toolbar.panels.cache.CacheDebugPanel,
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
]
from django-rq.
FYI, I just tested the latest master branch using django-redis==3.3
and django-redis==3.4
with django-debug-toolbar==1.0.1
and it seems to work alright.
from django-rq.
Related Issues (20)
- Regarding Logging
- django.core.exceptions.ImproperlyConfigured: Requested setting RQ_SHOW_ADMIN_LINK, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. HOT 2
- Worker pool implementation
- job_timeout is not killing subprocess
- Separate RQScheduler into its own fake model
- RQ Job Terminated Unexpectedly HOT 2
- Allow Specifying Default Serializer for Django-RQ Queue HOT 2
- How to run django-rq worker via Webhook/API call HOT 1
- Django dumpdata will fail because of unmanaged model HOT 1
- KeyError accessing stats page HOT 2
- Error in job_detail.html at line 226 HOT 2
- Sentinel support broken since 2.9.0 HOT 5
- Add support for floating point intervals in rescheduler command HOT 1
- ValueError: Invalid attribute name/AttributeError: module has no attribute
- keys of command in MULTI calls must be in same slot HOT 1
- TypeError in job_detail.html with Python 12 HOT 3
- Database Errors When Running rqworker-pool HOT 14
- RQ WorkerPool is not loading models at all
- `get_scheduler` should support a custom connection
- Tag 2.10.2 on Git HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-rq.