Closed BradleyKirton closed 3 years ago
This seems like a good idea to me and it should probably be combined with #99. Probably the right approach would be for DRAMATIQ_AUTODISCOVER_MODULES
to completely override the modules, so your example would end up as
DRAMATIQ_AUTODISCOVER_MODULES = ("tasks", "services")
so we can support both your and @thebjorn's use cases.
It would be easy to modify #99 to handle this case. Insert a second for-loop over DRAMATIQ_AUTODISCOVER_MODULES
between lines 156/157, and the except ImportError
on L170 will take care of the rest.
I've updated PR #99 to support this use case, with the semantics in the comment from @Bogdanp. I used a list in the documentation, since that will lead to fewer support incidents with one-element tuples.
Hi @Bogdanp and @thebjorn, thank you both :)
Please let me know if there is anything I can do to help out.
@Bogdanp is there anything more I can do to get #99 merged?
@thebjorn sorry, I've been busy, but I'll try to take a look at this again during the weekend.
Hi there, I would like to find out what your view is on making the python module name in which tasks reside configurable.
I see from the code that it will always need to lookup tasks in "tasks.py" so that django_dramatiq's own internal tasks are discovered. Given this I can think of a couple ways to extend the task list discovered by the "discover_tasks_modules" function in the "django_dramatiq.management.commands.rundramatiq" module.
DRAMATIQ_AUTODISCOVER_MODULES = ("services", )
"django_dramatiq" would lookup all the "tasks" and "services" sub modules.I am happy to override the "rundramatiq" command in my own project but would like to hear your thoughts option 1 above.