def run(self): if self.cfg.check_config: try: self.load() except: sys.stderr.write("\nError while loading the application:\n\n") traceback.print_exc() sys.stderr.flush() sys.exit(1) sys.exit(0) if self.cfg.spew: debug.spew() if self.cfg.daemon: util.daemonize() # set python paths if self.cfg.pythonpath and self.cfg.pythonpath is not None: paths = self.cfg.pythonpath.split(",") for path in paths: pythonpath = os.path.abspath(self.cfg.pythonpath) if pythonpath not in sys.path: sys.path.insert(0, pythonpath) try: Arbiter(self).run() except RuntimeError as e: sys.stderr.write("\nError: %s\n\n" % e) sys.stderr.flush() sys.exit(1)
def run(self): if self.cfg.check_config: try: self.load() except: msg = "\nError while loading the application:\n" print(msg, file=sys.stderr) traceback.print_exc() sys.stderr.flush() sys.exit(1) sys.exit(0) if self.cfg.spew: debug.spew() if self.cfg.daemon: util.daemonize(self.cfg.enable_stdio_inheritance) # set python paths if self.cfg.pythonpath: paths = self.cfg.pythonpath.split(",") for path in paths: pythonpath = os.path.abspath(path) if pythonpath not in sys.path: sys.path.insert(0, pythonpath) super().run()
def run(self): if self.cfg.check_config: try: self.load() except: msg = "\nError while loading the application:\n" print(msg, file=sys.stderr) traceback.print_exc() sys.stderr.flush() sys.exit(1) sys.exit(0) if self.cfg.spew: debug.spew() if self.cfg.daemon: util.daemonize(self.cfg.enable_stdio_inheritance) # set python paths if self.cfg.pythonpath: paths = self.cfg.pythonpath.split(",") for path in paths: pythonpath = os.path.abspath(path) if pythonpath not in sys.path: sys.path.insert(0, pythonpath) super(Application, self).run()
def run(self): if self.cfg.spew: debug.spew() if self.cfg.daemon: util.daemonize() else: os.setpgrp() self.configure_logging() Arbiter(self).run()
def run(self): # enable detailed debug logging if self.cfg.spew: debug.spew() # change working directory os.chdir(self.cfg.chdir) # run gunicorn super().run()
def run(self): if self.cfg.spew: debug.spew() if self.cfg.daemon: # daemonize should not close logfile fd, see method doc self.close_logfile() util.daemonize() self.configure_logging() else: os.setpgrp() Arbiter(self).run()
def run(self): if self.cfg.spew: debug.spew() if self.cfg.daemon: util.daemonize() else: try: os.setpgrp() except OSError, e: if e[0] != errno.EPERM: raise
def run(self): if self.cfg.spew: debug.spew() if self.cfg.daemon: util.daemonize() else: try: os.setpgrp() except OSError, e: if e[0] == errno.EPERM: sys.stderr.write("Error: You should use " "daemon mode here.\n") raise
def run(self): if self.cfg.check_config: try: self.load() except Exception: msg = "Error while loading the application" sys.exit(msg) sys.exit(0) if self.cfg.spew: debug.spew() if self.cfg.daemon: util.daemonize(self.cfg.enable_stdio_inheritance) super().run()
def run(self): # 配置校验无误 if self.cfg.check_config: try: # 加载配置 self.load() except: msg = "\nError while loading the application:\n" print(msg, file=sys.stderr) # 打印异常信息 traceback.print_exc() # 清空标准错误信息 sys.stderr.flush() sys.exit(1) sys.exit(0) if self.cfg.spew: # 打开了--spew开关 # Install a trace function that spews every line # executed by the server. debug.spew() if self.cfg.daemon: # run in daemon mode util.daemonize(self.cfg.enable_stdio_inheritance) # set python paths if self.cfg.pythonpath: paths = self.cfg.pythonpath.split(",") for path in paths: pythonpath = os.path.abspath(path) if pythonpath not in sys.path: sys.path.insert(0, pythonpath) # 运行入口 super().run()
def reload(self): self.do_load_config() if self.cfg.spew: debug.spew()
def reload(self): self.load_config() if self.cfg.spew: debug.spew() loglevel = self.LOG_LEVELS.get(self.cfg.loglevel.lower(), logging.INFO) self.logger.setLevel(loglevel)