Skip to content

Celery Monitor no longer works with Django 2.2 #107

@AndrewModus

Description

@AndrewModus

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions