How to use the kervi.core.utility.process._stop_processes function in kervi

To help you get started, we’ve selected a few kervi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kervi / kervi / kervi / kervi / module / __init__.py View on Github external
def stop(self, force_exit=True, restart=False):
        self.spine.send_command("kervi_action_module_exit")
        self.spine.trigger_event(
            "moduleStopped",
            self.config.module.id
        )
        self._logger.warn("stopping processes")
        process._stop_processes("module-" + self.config.module.id)
        self.spine.trigger_event("processTerminating", None, local_only=True)
        time.sleep(1)
        spine.Spine().stop()
        #for thread in threading.enumerate():
        #    print("running thread",thread.name)
        self._logger.info("module stopped")
        if force_exit:
            import os
            os._exit(0)
github kervi / kervi / kervi / build / lib / kervi / application / __init__.py View on Github external
def stop(self, force_exit=True, restart=False):
        self.spine.send_command("kervi_action_app_exit")
        import kervi.ui.webserver as webserver
        
        webserver.stop()
        print("stopping processes")
        import kervi.core.utility.process as process
        process._stop_processes("app-" + self.config.application.id)
        self.spine.trigger_event("processTerminating", None, local_only=True)
        time.sleep(1)
        self.spine.stop()
        #for thread in threading.enumerate():
        #    print("running thread",thread.name)
        print("application stopped")
        #exit()
        if force_exit:
            import os
            os._exit(0)
github kervi / kervi / kervi / kervi / application / __init__.py View on Github external
def stop(self, force_exit=True, restart=False):
        self._logger.warn("stopping processes")
        self._in_stop = True
        self.spine.send_command("kervi_action_app_exit")
        
        if self._discovery_thread:
            self._discovery_thread.terminate()

        import kervi.core.utility.process as process
        process._stop_processes("app-" + self.config.application.id)
        self.spine.trigger_event("processTerminating", None, local_only=True)
        time.sleep(1)
        self.bus_manager.stop()
        self._log_handler.stop()
        
        if self.config.development.debug_threads:
            time.sleep(1)
            for thread in threading.enumerate():
                print("running thread",thread.name)
        self._logger.info("application stopped")
        
        import psutil
        current_process = psutil.Process()
        children = current_process.children(recursive=True)
        for child in children:
            child.kill()