Checklist
Related Issues and Possible Duplicates
Related Issues
Possible Duplicates
Brief Summary
I am currently trying to build an abstraction over celery that would allow registering and running tasks.
However, my tests do not work because the worker doesn't find the tasks, and even using the default_worker_tasks doesn't work because the decorator used to define the tasks isn't the celery.Celery(...).task one, but a custom decorator that returns a custom Task class which completely abstracts celery away.
It would be very helpful to have a way to register tasks in the worker individually, by passing an instance of the celery.Task class to some fixture
Design
Have a fixture called something like register_task that would look like this
@pytest.fixture
def register_task():
def _register(task: celery.Task):
... # do something to register
return _register
# in the test
@pytest.fixture
def register_test_tasks(default_worker_app, register_task):
task = default_worker_app.task(some_callable, name="task_name"))
register_task(task)
Proposed Behavior
The behaviour is simply being able to register tasks individually in the worker, by passing an instance of celery.Task the the fixture defined above.
Proposed UI/UX
Diagrams
N/A
Alternatives
None
Checklist
for similar or identical feature requests.
for existing proposed implementations of this feature.
to find out if the same feature was already implemented in the
main branch.
(If there are none, check this box anyway).
Related Issues and Possible Duplicates
Related Issues
Possible Duplicates
Brief Summary
I am currently trying to build an abstraction over celery that would allow registering and running tasks.
However, my tests do not work because the worker doesn't find the tasks, and even using the
default_worker_tasksdoesn't work because the decorator used to define the tasks isn't the celery.Celery(...).task one, but a custom decorator that returns a customTaskclass which completely abstracts celery away.It would be very helpful to have a way to register tasks in the worker individually, by passing an instance of the celery.Task class to some fixture
Design
Have a fixture called something like
register_taskthat would look like thisProposed Behavior
The behaviour is simply being able to register tasks individually in the worker, by passing an instance of
celery.Taskthe the fixture defined above.Proposed UI/UX
Diagrams
N/A
Alternatives
None