def run_worker(worker_id=None): """Run worker daemon. It will run in the same thread.""" # Check connection to the db check_connection() logging.info('Init Worker') worker_config = get_worker_config() logging.info(worker_config) worker = Worker(worker_config, worker_id) # Activate the server; this will keep running until you # interrupt the program with Ctrl-C try: logging.info("Start serving") worker.serve_forever() except KeyboardInterrupt: worker.stop() sys.exit(0)
def run_master(): """Run master Daemon. It will run in the same thread.""" # Check connection to the db check_connection() logging.info('Init Master') master_config = get_master_config() logging.info(master_config) master = Master((master_config.host, master_config.port), ClientTCPHandler) # Activate the server; this will keep running until you # interrupt the program with Ctrl-C try: logging.info("Start serving") master.serve_forever() except KeyboardInterrupt: master.stop() sys.exit(0)
def run_api(): global _config _config = get_config() check_connection() # Create default user if in single user mode if not _config.auth.secret_key: logging.info('Single user mode') _init_default_user() else: logging.info('Multiple user mode') CORS(app, resources={r"/*": {"origins": "*"}}) app.run( host=_config.web.host, port=_config.web.port, debug=_config.web.debug, use_reloader=False, )