Hello Roberto, I've tried to start web2py has you demonstrated:
uwsgi --socket :3031 --spooler myspool --master --processes 4 -- import mytasks --module web2py.wsgihandler but I got this error: [spooler directory] access(): No such file or directory [uwsgi.c line 2994] What is wrong? On Jul 12, 6:01 am, "Roberto De Ioris" <robe...@unbit.it> wrote: > > 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 Iorishttp://unbit.it