Conversation
e-stepanov
approved these changes
Mar 23, 2026
| from app.celery import celery as celery_app | ||
|
|
||
|
|
||
| __all__ = ["celery_app"] |
Contributor
There was a problem hiding this comment.
На одном из последних проектов я делал ровно такой же фикс (единственно, вызов autodiscover_tasks не изменял). Удивляет, что до этого почему-то ни разу не сталкивался с этой проблемой.
Contributor
|
спасибо 👍
на текущее решение у нас тоже нет тестов, хе-хе ) |
nvo87
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Издревле повелось, что мы инициализируем celery способом, отличным от документации.
В принципе всё работает, кроме довольно редкого случая, когда код тасок лежит в приложении, которое нигде не импортируется. В таком случае таски уходят в очередь, но воркер выдаёт
NotRegistered, т.к. не знает этой таски.Способ воспроизвести:
triggers. Нигде его не импортируем код из него.triggers.checkcelery -A app inspect registered. Видим, что таски в нём нет, а попытка её отправить в очередь выдастNotRegistered.В ПР я привёл регистрацию тасок к тому, как описано в документации. Понимаю, что у нас на это нет тестов, но я честно скопировал и вставил из другого рабочего проекта. Поэтому предлагаю смёрджить, если ни у кого нет возражений.