# Advanced options
group = optparse.OptionGroup(parser, "Advanced options")
- group.add_option('--auto-reload', dest='auto_reload', action='store_true', my_default=False, help='enable auto reload')
+ if os.name == 'posix':
+ group.add_option('--auto-reload', dest='auto_reload', action='store_true', my_default=False, help='enable auto reload')
group.add_option('--debug', dest='debug_mode', action='store_true', my_default=False, help='enable debug mode')
group.add_option("--stop-after-init", action="store_true", dest="stop_after_init", my_default=False,
help="stop the server after its initialization")
help="Use the unaccent function provided by the database when available.")
parser.add_option_group(group)
- group = optparse.OptionGroup(parser, "Multiprocessing options")
- # TODO sensible default for the three following limits.
- group.add_option("--workers", dest="workers", my_default=0,
- help="Specify the number of workers, 0 disable prefork mode.",
- type="int")
- group.add_option("--limit-memory-soft", dest="limit_memory_soft", my_default=2048 * 1024 * 1024,
- help="Maximum allowed virtual memory per worker, when reached the worker be reset after the current request (default 671088640 aka 640MB).",
- type="int")
- group.add_option("--limit-memory-hard", dest="limit_memory_hard", my_default=2560 * 1024 * 1024,
- help="Maximum allowed virtual memory per worker, when reached, any memory allocation will fail (default 805306368 aka 768MB).",
- type="int")
- group.add_option("--limit-time-cpu", dest="limit_time_cpu", my_default=60,
- help="Maximum allowed CPU time per request (default 60).",
- type="int")
- group.add_option("--limit-time-real", dest="limit_time_real", my_default=120,
- help="Maximum allowed Real time per request (default 120).",
- type="int")
- group.add_option("--limit-request", dest="limit_request", my_default=8192,
- help="Maximum number of request to be processed per worker (default 8192).",
- type="int")
- parser.add_option_group(group)
+ if os.name == 'posix':
+ group = optparse.OptionGroup(parser, "Multiprocessing options")
+ # TODO sensible default for the three following limits.
+ group.add_option("--workers", dest="workers", my_default=0,
+ help="Specify the number of workers, 0 disable prefork mode.",
+ type="int")
+ group.add_option("--limit-memory-soft", dest="limit_memory_soft", my_default=2048 * 1024 * 1024,
+ help="Maximum allowed virtual memory per worker, when reached the worker be reset after the current request (default 671088640 aka 640MB).",
+ type="int")
+ group.add_option("--limit-memory-hard", dest="limit_memory_hard", my_default=2560 * 1024 * 1024,
+ help="Maximum allowed virtual memory per worker, when reached, any memory allocation will fail (default 805306368 aka 768MB).",
+ type="int")
+ group.add_option("--limit-time-cpu", dest="limit_time_cpu", my_default=60,
+ help="Maximum allowed CPU time per request (default 60).",
+ type="int")
+ group.add_option("--limit-time-real", dest="limit_time_real", my_default=120,
+ help="Maximum allowed Real time per request (default 120).",
+ type="int")
+ group.add_option("--limit-request", dest="limit_request", my_default=8192,
+ help="Maximum number of request to be processed per worker (default 8192).",
+ type="int")
+ parser.add_option_group(group)
# Copy all optparse options (i.e. MyOption) into self.options.
for group in parser.option_groups:
'list_db', 'xmlrpcs', 'proxy_mode',
'test_file', 'test_enable', 'test_commit', 'test_report_directory',
'osv_memory_count_limit', 'osv_memory_age_limit', 'max_cron_threads', 'unaccent',
- 'workers', 'limit_memory_hard', 'limit_memory_soft', 'limit_time_cpu', 'limit_time_real', 'limit_request',
- 'auto_reload', 'data_dir',
+ 'data_dir',
+ ]
+
+ posix_keys = [
+ 'auto_reload', 'workers',
+ 'limit_memory_hard', 'limit_memory_soft',
+ 'limit_time_cpu', 'limit_time_real', 'limit_request',
]
+ if os.name == 'posix':
+ keys += posix_keys
+ else:
+ self.options.update(dict.fromkeys(posix_keys, None))
+
+ # Copy the command-line arguments...
for arg in keys:
- # Copy the command-line argument...
if getattr(opt, arg) is not None:
self.options[arg] = getattr(opt, arg)
# ... or keep, but cast, the config file value.