> Hey everyone,
>
> I was wondering if it's possible or if there were plans to allow the
> uWSGI spooler to distribute tasks amongst multiple threads.  That is,
> if I had 4 spooler threads and 8 tasks, then tasks 0-3 would be
> executed simultaneously by the threads, and 4-7 would be executed
> afterwards.
>
> Thanks in advance,
> Ryan-
>

This is funny, today we talked about this in the irc channel, and there is
a code example (requires latest tip uWSGI)


http://projects.unbit.it/uwsgi/browser/contrib/spoolqueue

You define a function for each queue and how many threads you want for
each queue:

http://projects.unbit.it/uwsgi/browser/contrib/spoolqueue/tasks.py

than you can enqueue tasks in the queue you want:

http://projects.unbit.it/uwsgi/browser/contrib/spoolqueue/producer.py

Pay attention: you need to use --spooler-import instead of --import to
import your tasks. (spooler-import is avalable only in latest tip)
... and remember to enable threads (--enable-threads)

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to