Open MechanisM opened 7 years ago
Hello! I would like to use uWSGI spooler for async tasks. It can be almost the same as tasks.py:
uWSGI
spooler
tasks.py
from django_uwsgi.decorators import spool from statsy.models import StatsyObject @spool def send(**kwargs): obj = StatsyObject.create(**kwargs) return obj.serialize() @spool def send_callback(result, callback_path): module, callback = callback_path.rsplit('.', 1) module = importlib.import_module(module) callback = getattr(module, callback) return callback(result)
but file name can be smth like spooler.py or smth like that. and then in uwsgi.ini:
uwsgi.ini
spooler = spooler spooler-import = statsy.spooler
just needed some workaround to switch between celery and spooler(or even rq can be added) in core.py:
celery
rq
core.py
send_task.spool(kwargs=self._clean_kwargs_async(kwargs), link=callback)
personally I prefer not to use celery when there's not so lots of tasks, and since I deploy ьн project via uwsgi, I can use uwsgi's spooler and don't need to install and setup huge celery.
uwsgi
Hi! Good idea in case you are not using celery in your project and want to keep your stack as minimal as possible.
Hello! I would like to use
uWSGI
spooler
for async tasks. It can be almost the same astasks.py
:but file name can be smth like spooler.py or smth like that. and then in
uwsgi.ini
:just needed some workaround to switch between
celery
andspooler
(or evenrq
can be added) incore.py
:personally I prefer not to use
celery
when there's not so lots of tasks, and since I deploy ьн project viauwsgi
, I can useuwsgi
'sspooler
and don't need to install and setup hugecelery
.