Re: [uWSGI] how to use @timer decorator?
Hi, I'd like to use the @timer decorator to periodically execute some offline processes, like scanning a directory and adding to a database. But if I include the file that defines this function from my models.py, it's defined once on each worker process, and the timer signal is emitted several times. This does not exactly solve your problem, but could provide some tools. I have found Advanced Python Scheduler to be very opinion free library of doing scheduled code in Python applications and works well with all kind of deployments. http://apscheduler.readthedocs.org/ APS can run inside a single process as threaded, or separately in an external process with various backends to store tasks (like in-process memory). Cheers, Mikko ___ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
[uWSGI] Resource temporarily unavailable ( uwsgi + nginx + mysql )
Hi, I am getting below error everyday. i don't know what setting i missed. Please help me Error : 2015/02/06 11:49:06 [error] 23306#0: *49 connect() to unix:///var/run/uwsgi/test_uwsgi.sock failed (11: Resource temporarily unavailable) while connecting to upstream , client: 192.168.1.10, server: test.org, request: GET /accounts/profile/gfgckkp/ HTTP/1.1, upstream: uwsgi://unix:///var/run/uwsgi/test_uwsgi.sock: , host: test.org My uwsgi.ini file [uwsgi] ## Django-related settings chdir=/websites_dir/django_test/test module=test.wsgi:application ## The Virtualenv virtualenv=/websites_dir/django_test/test_virtualenv ## socket full path socket=/var/run/uwsgi/test_uwsgi.sock ## appropriate user and permissions uid=apache gid=apache chmod-socket=664 chown-socket=apache:apache ## process-related settings ## master=True ## maximum number of worker processes workers=8 ## process ID path pidfile=/websites_dir/django_test/test/uwsgi-master.pid ## respawn processes after serving 3 requests max-requests=3 ## background the process log daemonize=/var/log/uwsgi/django_test.log log-date=%%a %%b %%d %%H:%%M:%%S *Thanks RegardsManivel Rajendran* ___ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Re: [uWSGI] Resource temporarily unavailable ( uwsgi + nginx + mysql )
Hi, I am getting below error everyday. i don't know what setting i missed. Please help me Error : 2015/02/06 11:49:06 [error] 23306#0: *49 connect() to unix:///var/run/uwsgi/test_uwsgi.sock failed (11: Resource temporarily unavailable) while connecting to upstream , client: 192.168.1.10, server: test.org, request: GET /accounts/profile/gfgckkp/ HTTP/1.1, upstream: uwsgi://unix:///var/run/uwsgi/test_uwsgi.sock: , host: test.org My uwsgi.ini file [uwsgi] ## Django-related settings chdir=/websites_dir/django_test/test module=test.wsgi:application ## The Virtualenv virtualenv=/websites_dir/django_test/test_virtualenv ## socket full path socket=/var/run/uwsgi/test_uwsgi.sock ## appropriate user and permissions uid=apache gid=apache chmod-socket=664 chown-socket=apache:apache ## process-related settings ## master=True ## maximum number of worker processes workers=8 ## process ID path pidfile=/websites_dir/django_test/test/uwsgi-master.pid ## respawn processes after serving 3 requests max-requests=3 ## background the process log daemonize=/var/log/uwsgi/django_test.log log-date=%%a %%b %%d %%H:%%M:%%S This generally happens when your app has no more processes to manage requests and the listen queue is full. Use uwsgitop (or similar) to monitor it and eventually tune the number of processes. -- Roberto De Ioris http://unbit.com ___ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Re: [uWSGI] [Help Needed] Cannot allocate memory
My uWSGI configuration is as follow. [uwsgi] socket = /var/run/uwsgi/myapp.sock ;http = :8080 stats = 127.0.0.1:9191 pidfile = /var/run/uwsgi/myapp.pid daemonize = /var/log/uwsgi/myapp.log log-slow = true master = true chdir = /srv/myapp wsgi-file = /srv/myapp/main.py processes = 4 enable-threads = true threads = 2 ; 4 offload-threads = 0 ; 1 single-interpreter = true harakiri = 30 limit-post = 65536 post-buffering = 8192 uid = root ;uid = appuserid #gid = i2c #queue = 10 queue = 10 #queue-blocksize = 50 queue-blocksize = 50 reload-os-env = true locks = 2 Regards, Poh Yee Hui On 2/4/2015 10:36 PM, Roberto De Ioris wrote: Hi, I would like to ask for some help regarding issues with memory allocation. This is the error that I have found in the log. malloc(): Cannot allocate memory [core/utils.c line 1781] !!! tried memory allocation of 1768781160 bytes !!! *** backtrace of 7276 *** *** end of backtrace *** This is the configuration I am using: * Raspberry Pi model B (first generation) * Raspbian with kernel 3.12.35+ * uWSGI 2.0.9 * Nginx 1.2.1 * Python 2.7.3 The backtrace seems to be empty. Do I have to manually activate the backtrace in order to see what is going on? Thank you. - Hi, paste your uWSGI configuration, you are allocating a huge memory area, let's see if it is caused by some configuration option. ___ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
[uWSGI] how to use @timer decorator?
Hi, I'm writing a Django application and want to use some extra facilities of uWSGI. I'd like to use the @timer decorator to periodically execute some offline processes, like scanning a directory and adding to a database. But if I include the file that defines this function from my models.py, it's defined once on each worker process, and the timer signal is emitted several times. is there some way to restrict the signal to be registered only once? -- Javier ___ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Re: [uWSGI] how to use @timer decorator?
Hi, I'm writing a Django application and want to use some extra facilities of uWSGI. I'd like to use the @timer decorator to periodically execute some offline processes, like scanning a directory and adding to a database. But if I include the file that defines this function from my models.py, it's defined once on each worker process, and the timer signal is emitted several times. is there some way to restrict the signal to be registered only once? Put it in wsgi.py or place in a dedicated file you can import with --shared-pyimport file -- Roberto De Ioris http://unbit.com ___ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi