-
-
Save fogmoon/b7a7f6ec5c0a18b2902206b54d01a280 to your computer and use it in GitHub Desktop.
uwsgi-2.0.x emperor not killing spooler processes example code and ini
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
plugins = python27 | |
socket = 127.0.0.1:3090 | |
master = true | |
enable-threads = true | |
log-syslog = uwsgi.test | |
disable-logging = true | |
mule = /path/to/test_kill.py | |
spooler-processes = 2 | |
spooler = /var/spool/uwsgi/test | |
spooler-import = /path/to/test_kill.py | |
spooler-quiet = true | |
touch-reload = /path/to/test_kill.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uwsgi | |
from time import sleep | |
from uwsgidecorators import spoolraw | |
@spoolraw | |
def worker(env): | |
""" | |
Spooler code | |
""" | |
try: | |
print "spooler got env", env | |
except Exception as e: | |
print e | |
return uwsgi.SPOOL_RETRY | |
else: | |
return uwsgi.SPOOL_OK | |
if not uwsgi.i_am_the_spooler(): | |
while True: | |
print "mule sleep 2" | |
sleep(2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
plugins = python27 | |
socket = 127.0.0.1:3091 | |
master = true | |
enable-threads = true | |
log-syslog = uwsgi.test_remote | |
disable-logging = true | |
mule = /path/to/test_remote_spooler.py | |
spooler-external = /var/spool/uwsgi/test | |
spooler-quiet = true | |
touch-reload = /path/to/test_remote_spooler.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uwsgi | |
from time import sleep, time | |
if not uwsgi.i_am_the_spooler(): | |
while True: | |
print "remote spooling a message" | |
uwsgi.spool( | |
at=time() + 2, | |
msg={'msg': "coconut"}, | |
spooler='/var/spool/uwsgi/test', | |
ud_spool_func='worker', | |
) | |
sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment