celery-haystack icon indicating copy to clipboard operation
celery-haystack copied to clipboard

Fix import to make compatible with celery 5.x.

Open debdolph opened this issue 4 years ago • 2 comments

debdolph avatar Nov 29 '20 13:11 debdolph

I tried to implement this branch but got a

  File "/usr/local/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 175, in <listcomp>
    for receiver in self._live_receivers(sender)
  File "/usr/local/lib/python3.6/site-packages/celery_haystack/signals.py", line 21, in enqueue_save
    return self.enqueue('update', instance, sender, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/celery_haystack/signals.py", line 44, in enqueue
    enqueue_task(action, instance)
  File "/usr/local/lib/python3.6/site-packages/celery_haystack/utils.py", line 47, in enqueue_task
    task_func
  File "/usr/local/lib/python3.6/site-packages/django/db/transaction.py", line 128, in on_commit
    get_connection(using).on_commit(func)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 628, in on_commit
    func()
  File "/usr/local/lib/python3.6/site-packages/celery_haystack/utils.py", line 42, in <lambda>
    task_func = lambda: task.apply_async((action, identifier), kwargs, **options)
  File "/usr/local/lib/python3.6/site-packages/celery/app/task.py", line 559, in apply_async
    link=link, link_error=link_error, **options)
  File "/usr/local/lib/python3.6/site-packages/celery/app/task.py", line 754, in apply
    task = app._tasks[self.name]
  File "/usr/local/lib/python3.6/site-packages/celery/app/registry.py", line 18, in __missing__
    raise self.NotRegistered(key)
celery.exceptions.NotRegistered: None

i suspect celery's internal support for class based tasks has declined. the solution ended up being subclassing the default handler, attaching a name attribute to that, and then pointing to that as the default handler.

update: this library is abandoned and this branch won't work in any reality. ended up architecting around this lib

yeago avatar Dec 19 '20 23:12 yeago

This, including the exception mentioned by @yeago, are now fixed in our fork: https://pypi.org/project/celery-haystack-ng/

Natureshadow avatar Feb 11 '21 22:02 Natureshadow