def shutdown_components(self): """Execute before the reactor is shut down""" self.log.info('exiting-on-keyboard-interrupt') for component in reversed(registry.iterate()): yield component.stop() import threading self.log.info('THREADS:') main_thread = threading.current_thread() for t in threading.enumerate(): if t is main_thread: continue if not t.isDaemon(): continue self.log.info('joining thread {} {}'.format( t.getName(), "daemon" if t.isDaemon() else "not-daemon")) t.join()