equal
deleted
inserted
replaced
15 import time |
15 import time |
16 import threading |
16 import threading |
17 import subprocess |
17 import subprocess |
18 |
18 |
19 from cubicweb import BadCommandUsage, ExecutionError |
19 from cubicweb import BadCommandUsage, ExecutionError |
20 from cubicweb.__pkginfo__ import numversion as cwversion |
|
21 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg |
20 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg |
22 from cubicweb.cwctl import CWCTL, InstanceCommand, init_cmdline_log_threshold |
21 from cubicweb.cwctl import CWCTL, InstanceCommand, init_cmdline_log_threshold |
23 from cubicweb.pyramid import wsgi_application_from_cwconfig |
22 from cubicweb.pyramid import wsgi_application_from_cwconfig |
24 from cubicweb.server import set_debug |
23 from cubicweb.server import set_debug |
25 |
24 |
84 {'type': 'int', |
83 {'type': 'int', |
85 'default': None, |
84 'default': None, |
86 'metavar': 'N', |
85 'metavar': 'N', |
87 'help': 'Dump profile stats to ouput every N requests ' |
86 'help': 'Dump profile stats to ouput every N requests ' |
88 '(default: 100)'}), |
87 '(default: 100)'}), |
|
88 ('param', |
|
89 {'short': 'p', |
|
90 'type': 'named', |
|
91 'metavar': 'key1:value1,key2:value2', |
|
92 'default': {}, |
|
93 'help': 'override <key> configuration file option with <value>.'}), |
89 ) |
94 ) |
90 if cwversion >= (3, 21, 0): |
|
91 options = options + ( |
|
92 ('param', |
|
93 {'short': 'p', |
|
94 'type': 'named', |
|
95 'metavar': 'key1:value1,key2:value2', |
|
96 'default': {}, |
|
97 'help': 'override <key> configuration file option with <value>.', |
|
98 }), |
|
99 ) |
|
100 |
95 |
101 _reloader_environ_key = 'CW_RELOADER_SHOULD_RUN' |
96 _reloader_environ_key = 'CW_RELOADER_SHOULD_RUN' |
102 _reloader_filelist_environ_key = 'CW_RELOADER_FILELIST' |
97 _reloader_filelist_environ_key = 'CW_RELOADER_FILELIST' |
103 |
98 |
104 def debug(self, msg): |
99 def debug(self, msg): |
301 |
296 |
302 if autoreload and not os.environ.get(self._reloader_environ_key): |
297 if autoreload and not os.environ.get(self._reloader_environ_key): |
303 return self.restart_with_reloader() |
298 return self.restart_with_reloader() |
304 |
299 |
305 cwconfig = cwcfg.config_for(appid, debugmode=debugmode) |
300 cwconfig = cwcfg.config_for(appid, debugmode=debugmode) |
306 if cwversion >= (3, 21, 0): |
|
307 cwconfig.cmdline_options = self.config.param |
|
308 if autoreload: |
301 if autoreload: |
309 _turn_sigterm_into_systemexit() |
302 _turn_sigterm_into_systemexit() |
310 self.debug('Running reloading file monitor') |
303 self.debug('Running reloading file monitor') |
311 extra_files = [sys.argv[0]] |
304 extra_files = [sys.argv[0]] |
312 extra_files.extend(self.configfiles(cwconfig)) |
305 extra_files.extend(self.configfiles(cwconfig)) |