I want to use background callbacks and individual celery tasks with the same Celery queue.
My current structure is the following to avoid circular imports:
/
-app.py (creates Dash app, imports celery_manager)
-app_global.py (created celery_app and celery_manager. celery tasks defined here)
-app_callbacks.py (has a callback that adds tasks to celery queue with celery_app object)
-pages/page.py (has a background callback, imports app but not celery_app, background=True)
By having celery tasks defined in app_global.py where the celery_app instance is defined, they are registered in the celery tasks dictionary, but Dash’s background_callback’s aren’t registered and I get the error:
“Received unregistered task of type ‘long_callback_5abe53881a52c2a77290c5e53062ad47fbbd1e18’.”
I’m looking for any help to solve this. My current ideas are (1) background callbacks and celery tasks shouldn’t be in the same queue, and (2) the app = Dash() object needs to be instantiated in the same file as celery_app = Celery().
Yeah I did, that’s a part of my confusion. Celery isn’t recognizing any background callbacks across my application. It also lead to circular import problems.