> Robeto;
>
> I am not exactly sure how I would start my application in the background
> using this method;


The spooler is started (and managed) by uWSGI, you do not need to
daemonize it. If you want to daemonize all of your stack, simply add
--daemonize <logfile> to uWSGI options.

>
>
> I think I need to run my app in the background and then access it to
> add_tasks etc;
>
> Thanks.
>
> David.
>
>

If i have understand correctly, you want some kind of daemon receiving
messages from your workers. You cannot use threads (or their queue) as you
will lose communication between processes (a thread created in process 1
is obviously not available on process 2).

This example:

http://projects.unbit.it/uwsgi/wiki/Example#threadqueue

can be of interest for you, but you can use it only in multithreaded
environment (no multiple processes) otherwise you will need to create a
independent threadpool for each process (as the example does)

The Spooler is a process receiving messages, you can configure it to work
in the way you need without using decorators:

# create the spooler code server

def receive_request(dictionary_message):
    print("i have received a message")
    ...do something...

# attach the function to the spooler

uwsgi.spooler = receive_request

Then from your workers/threads send messages (dictionary of strings) to it:

uwsgi.spool({'name':'foo','surname':'bar'})

If i have not understand correctly probably it is better for you to send a
real example of what you want to do.

-- 
Roberto De Ioris
http://unbit.it

Reply via email to