Skip to content
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

Celery Monitor no longer works with Django 2.2 #107

Open
AndrewModus opened this issue Apr 5, 2019 · 8 comments · May be fixed by #114
Open

Celery Monitor no longer works with Django 2.2 #107

AndrewModus opened this issue Apr 5, 2019 · 8 comments · May be fixed by #114

Comments

@AndrewModus
Copy link

AndrewModus commented Apr 5, 2019

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/

@cryocaustik
Copy link

I am having the same issue now. Any updates on this?

@stygmate
Copy link

stygmate commented May 2, 2019

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.

tony added a commit to eduflow/django-celery-monitor that referenced this issue Jun 19, 2019
@tony tony linked a pull request Jun 19, 2019 that will close this issue
@nachiket-lab
Copy link

Has anyone found a workaround for this yet?
Really want to use this and ditch flower.

@SYNchroACK
Copy link

SYNchroACK commented Aug 22, 2019

@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

@nachiket-lab
Copy link

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?

@killswitch-GUI
Copy link

I would really love if one of the PRs would merge :( I want to use this project too.

@fericsepi
Copy link

This is still an issue, any chance of getting a new release out?

@siovene
Copy link

siovene commented Apr 10, 2023

Adding my voice to the chorus.

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 a pull request may close this issue.

8 participants