def parse_configs(config_files): """Reads command line options / config file and bootstraps logging. """ parse_command_line(final=False) if options.config: configs_to_read = options.config else: configs_to_read = config_files configs_to_read = filter( None, [configs_to_read] if not isinstance(configs_to_read, (list, tuple)) else configs_to_read) for config in configs_to_read: parse_config_file(config, final=False) # override options from config with command line options parse_command_line(final=False) bootstrap_core_logging() for config in configs_to_read: log.debug('using config: %s', config) if options.autoreload: tornado.autoreload.watch(config)
def parse_configs(config_files): """Reads command line options / config file and bootstraps logging. """ parse_command_line(final=False) if options.config: configs_to_read = options.config else: configs_to_read = config_files configs_to_read = filter( None, [configs_to_read] if not isinstance(configs_to_read, (list, tuple)) else configs_to_read ) for config in configs_to_read: parse_config_file(config, final=False) # override options from config with command line options parse_command_line(final=False) bootstrap_core_logging() for config in configs_to_read: log.debug('using config: %s', config) if options.autoreload: tornado.autoreload.watch(config)
def parse_configs_and_start(config_files): """ — read command line options and config file — daemonize """ tornado.options.parse_command_line(final=False) if options.config: configs_to_read = options.config else: configs_to_read = config_files configs_to_read = filter( None, [configs_to_read] if not isinstance(configs_to_read, (list, tuple)) else configs_to_read ) for config in configs_to_read: tornado.options.parse_config_file(config, final=False) # override options from config with command line options tornado.options.parse_command_line(final=False) if options.daemonize: import daemon ctx = daemon.DaemonContext() ctx.initgroups = False # For python-daemon >= 2 ctx.open() if options.pidfile: with open(options.pidfile, 'w+') as pidfile: pidfile.write(str(os.getpid())) bootstrap_core_logging() for config in configs_to_read: log.debug('using config: %s', config) tornado.autoreload.watch(config)
def parse_configs_and_start(config_files): """ — read command line options and config file — daemonize """ tornado.options.parse_command_line(final=False) if options.config: configs_to_read = options.config else: configs_to_read = config_files configs_to_read = filter( None, [configs_to_read] if not isinstance(configs_to_read, (list, tuple)) else configs_to_read) for config in configs_to_read: tornado.options.parse_config_file(config, final=False) # override options from config with command line options tornado.options.parse_command_line(final=False) if options.daemonize: import daemon ctx = daemon.DaemonContext() ctx.initgroups = False # For python-daemon >= 2 ctx.open() if options.pidfile: with open(options.pidfile, 'w+') as pidfile: pidfile.write(str(os.getpid())) bootstrap_core_logging() for config in configs_to_read: log.debug('using config: %s', config) tornado.autoreload.watch(config)