I have a GCE server setup to handle some data analysis. I can communicate with it via ws
using twisted
. I am the only client of this server.
System is setup like this:
spawn_multiprocessing_hierarchy()
reactor.run() # Blocks main thread
stop_everything_and_cleanup()
When I'm trying to stop the system and a client is connected, reactor
will ignore (or delay indefinitely perhaps?) SIGTERM
because it is handling client's connection. However, every other part of the system is fault-tolerant and reactor
never handles any critical data. It exists solely for monitoring purposes. This means that I could easily SIGKILL
it were it not for other multiprocess.Process
es which need to dump data in memory so that they could continue where they stopped last on next launch.
Is it possible to have SIGTERM
immediately (without waiting for running tasks in reactor to finish) drop any connections and stop the reactor?