def run(script_path, command_line, args): """Run a script in a separate thread and start a server for the app. This starts a blocking ioloop. Parameters ---------- script_path : str command_line : str args : [str] """ _fix_sys_path(script_path) _fix_matplotlib_crash() _fix_tornado_crash() _fix_sys_argv(script_path, args) _fix_pydeck_mapbox_api_warning() # Install a signal handler that will shut down the ioloop # and close all our threads _set_up_signal_handler() ioloop = tornado.ioloop.IOLoop.current() # Create and start the server. server = Server(ioloop, script_path, command_line) server.start(_on_server_start) # (Must come after start(), because this starts a new thread and start() # may call sys.exit() which doesn't kill other threads. server.add_preheated_report_session() # Start the ioloop. This function will not return until the # server is shut down. ioloop.start()
def run( main_script_path: str, command_line: Optional[str], args: List[str], flag_options: Dict[str, Any], ) -> None: """Run a script in a separate thread and start a server for the app. This starts a blocking ioloop. """ _fix_sys_path(main_script_path) _fix_matplotlib_crash() _fix_tornado_crash() _fix_sys_argv(main_script_path, args) _fix_pydeck_mapbox_api_warning() _install_config_watchers(flag_options) # Install a signal handler that will shut down the ioloop # and close all our threads _set_up_signal_handler() ioloop = tornado.ioloop.IOLoop.current() # Create and start the server. server = Server(ioloop, main_script_path, command_line) server.start(_on_server_start) # Start the ioloop. This function will not return until the # server is shut down. ioloop.start()