I have a RESTful API written in python using werkzeug. It runs with nginx/uWsgi. I would like to kill worker process when an internal error (LOST zookeeper session) occurs and let uWsgi will spawn a new worker.
If I call sys.exit(0), worker does not exit. Perhaps SystemExit or Exception is being caught somewhere. I am running as a service using init script with,
exec $root/run uwsgi --socket 127.0.0.1:3037 --master --workers 4 --threads 10 --harakiri 60 --die-on-term --thunder-lock --lazy-apps --py-tracebacker /tmp/ledgerwebtbsock --wsgi-file my_server.py --logto /my_server.py