django-celery-monitor
django-celery-monitor copied to clipboard
Celery Monitor no longer works with Django 2.2
Celery Monitor no longer works with Django 2.2:
More specifically:
[2019-04-05 10:05:57,937: ERROR/MainProcess] Error in timer: TypeError('get() argument after ** must be a mapping, not str')
Traceback (most recent call last):
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/kombu/asynchronous/timer.py", line 166, in apply_entry
entry()
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/kombu/asynchronous/timer.py", line 68, in __call__
return self.fun(*self.args, **self.kwargs)
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/kombu/asynchronous/timer.py", line 127, in _reschedules
return fun(*args, **kwargs)
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/celery/events/snapshot.py", line 72, in capture
self.state.freeze_while(self.shutter, clear_after=self.clear_after)
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/celery/events/state.py", line 456, in freeze_while
return fun(*args, **kwargs)
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/celery/events/snapshot.py", line 69, in shutter
self.on_shutter(self.state)
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/django_celery_monitor/camera.py", line 125, in on_shutter
self.handle_worker(worker)
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/django_celery_monitor/camera.py", line 77, in handle_worker
update_freq=self.worker_update_freq,
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/django_celery_monitor/managers.py", line 62, in update_heartbeat
defaults={'last_heartbeat': heartbeat},
File "/Users/andrewjones/.virtualenvs/dpet-janitor/lib/python3.7/site-packages/django_celery_monitor/managers.py", line 33, in select_for_update_or_create
obj = self.select_for_update().get(**lookup)
TypeError: get() argument after ** must be a mapping, not str
It looks like it's an issue where the django internal method _extract_model_params
is no longer returning (lookup, params)
but only params
Link to the django source code (search for def _extract_model_params
):
https://docs.djangoproject.com/en/2.1/_modules/django/db/models/query/
https://docs.djangoproject.com/en/2.2/_modules/django/db/models/query/
I am having the same issue now. Any updates on this?
Me too, I have looked quickly at the problem and it seems that select_for_update_or_create is an extension of select_for_update added to the base object manager. We have to rewrite this fonction ! I don't have time to check this now but if no one do, I will try later this month.
Has anyone found a workaround for this yet? Really want to use this and ditch flower.
@AndrewModus @NerdSec @cryocaustik @stygmate
Quick fix...
Go to file django_celery_monitor/managers.py
and the function select_for_update_or_create
should look like the following:
class ExtendedQuerySet(models.QuerySet):
def select_for_update_or_create(self, defaults=None, **kwargs):
return self.update_or_create(defaults, **kwargs)
https://github.com/SYNchroACK/django-celery-monitor/blob/master/django_celery_monitor/managers.py#L17
Seems like the repo is abandoned. @SYNchroACK Why not package & publish using pip? Or if @jezdez could transfer the ownership to someone for this project?
I would really love if one of the PRs would merge :( I want to use this project too.
This is still an issue, any chance of getting a new release out?
Adding my voice to the chorus.