Repository navigation
Celery task structure improvements - #300
Merged
Merged
Conversation
These are essential to making these into actual importable modules. Otherwise, they will be considered to be "implicit namespace modules", which have different behavior in subtle ways.
This is the canonical location for Celery tasks in Resonant. This is necessary to make `app.autodiscover_tasks()` work properly, as it scans the `INSTALLED_APPS` (in this case, `core`) for a `tasks` module. Perhaps this also wasn't working before due to the lack of `__init__.py`, so `tasks` wasn't considered a real module.
Previously, `@shared_task` was preferred by Resonant, but I realized that `@app.task` will be able to provide better typechecking. `@shared_task` is essential only for reusable apps (and `core` isn't reusable). I'll make an upstream change to the Resonant cookiecutter to prefer `@app.task` too.
BryonLewis
approved these changes
Jan 14, 2026
BryonLewis
left a comment
Collaborator
There was a problem hiding this comment.
LGTM - did a quick onceover, pulled and tested some tasks and everything seems to work well.
We'll be switching a lot of internal tasks to using a new tool created by vision (BatBot) for spectrogram generation anyways, I'll clean up then some of the mess of ./tasks/tasks and other stuff. Should be simplified a bit using BatBot.
Member
Author
|
@naglepuff I'd suggest just looking at the description of this PR, to be aware of the rationale. |
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.
__init__.pyfiles to tasksbats_ai.corepackageapp.autodiscover_tasks()work properly, as it scans theINSTALLED_APPS(in this case,core) for atasksmodule. Perhaps this also wasn't working before due to the lack of__init__.py, sotaskswasn't considered a real module.@app.taskinstead of@shared_task@shared_taskwas preferred by Resonant, but I realized that@app.taskwill be able to provide better typechecking.@shared_taskis essential only for reusable apps (andcoreisn't reusable). I'll make an upstream change to the Resonant cookiecutter to prefer@app.tasktoo.