I\'m working on a renderfarm, and I need my clients to be able to launch multiple instances of a renderer, without blocking so the client can receive new commands. I\'ve got
I found solution: stop pool in separate thread, like this:
def close_pool():
global pool
pool.close()
pool.terminate()
pool.join()
def term(*args,**kwargs):
sys.stderr.write('\nStopping...')
# httpd.shutdown()
stophttp = threading.Thread(target=httpd.shutdown)
stophttp.start()
stoppool=threading.Thread(target=close_pool)
stoppool.daemon=True
stoppool.start()
signal.signal(signal.SIGTERM, term)
signal.signal(signal.SIGINT, term)
signal.signal(signal.SIGQUIT, term)
Works fine and always i tested.
signal.SIGINT
Interrupt from keyboard (CTRL + C). Default action is to raise KeyboardInterrupt.
signal.SIGKILL
Kill signal. It cannot be caught, blocked, or ignored.
signal.SIGTERM
Termination signal.
signal.SIGQUIT
Quit with core dump.