Skip to content

Instantly share code, notes, and snippets.

@jmkacz
Created May 22, 2012 19:38
Show Gist options
  • Save jmkacz/2771144 to your computer and use it in GitHub Desktop.
Save jmkacz/2771144 to your computer and use it in GitHub Desktop.
my usage of TProcessPoolServer
import signal
def set_signal_handlers(server):
def clean_shutdown(signum, frame):
logging.info("Signal received: {0}".format(signum))
server.stop()
signal.signal(signal.SIGTERM, clean_shutdown)
signal.signal(signal.SIGINT, clean_shutdown)
server = TProcessPoolServer(processor, transport, tfactory, pfactory)
set_signal_handlers(server)
server.serve()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment