|
22 | 22 | from ._compat import IS_WINDOWS # noqa: WPS436 |
23 | 23 | from .plugins import Plugins |
24 | 24 | from .types import IpAddress |
25 | | -from .utils import bytes_, is_py2, set_open_file_limit |
| 25 | +from .utils import bytes_, is_py2, is_threadless, set_open_file_limit |
26 | 26 | from .constants import COMMA, DEFAULT_DATA_DIRECTORY_PATH, DEFAULT_NUM_ACCEPTORS, DEFAULT_NUM_WORKERS |
27 | 27 | from .constants import DEFAULT_DEVTOOLS_WS_PATH, DEFAULT_DISABLE_HEADERS, PY2_DEPRECATION_MESSAGE |
28 | 28 | from .constants import PLUGIN_DASHBOARD, PLUGIN_DEVTOOLS_PROTOCOL, DEFAULT_MIN_COMPRESSION_LIMIT |
@@ -186,7 +186,7 @@ def initialize( |
186 | 186 | for p in FlagParser.get_default_plugins(args) |
187 | 187 | ] |
188 | 188 | requested_plugins = Plugins.resolve_plugin_flag( |
189 | | - args.plugins, opts.get('plugins', None), |
| 189 | + args.plugins, opts.get('plugins'), |
190 | 190 | ) |
191 | 191 | plugins = Plugins.load( |
192 | 192 | default_plugins + auth_plugins + requested_plugins, |
@@ -340,21 +340,29 @@ def initialize( |
340 | 340 | ), |
341 | 341 | ) |
342 | 342 | args.timeout = cast(int, opts.get('timeout', args.timeout)) |
343 | | - args.threadless = cast(bool, opts.get('threadless', args.threadless)) |
344 | | - args.threaded = cast(bool, opts.get('threaded', args.threaded)) |
345 | | - args.pid_file = cast( |
346 | | - Optional[str], opts.get( |
347 | | - 'pid_file', |
348 | | - args.pid_file, |
349 | | - ), |
350 | | - ) |
351 | 343 | args.local_executor = cast( |
352 | 344 | bool, |
353 | 345 | opts.get( |
354 | 346 | 'local_executor', |
355 | 347 | args.local_executor, |
356 | 348 | ), |
357 | 349 | ) |
| 350 | + args.threaded = cast(bool, opts.get('threaded', args.threaded)) |
| 351 | + # Pre-evaluate threadless values based upon environment and config |
| 352 | + # |
| 353 | + # --threadless is now default mode of execution |
| 354 | + # but we still have exceptions based upon OS config. |
| 355 | + # Make sure executors are not started if is_threadless |
| 356 | + # evaluates to False. |
| 357 | + args.threadless = cast(bool, opts.get('threadless', args.threadless)) |
| 358 | + args.threadless = is_threadless(args.threadless, args.threaded) |
| 359 | + |
| 360 | + args.pid_file = cast( |
| 361 | + Optional[str], opts.get( |
| 362 | + 'pid_file', |
| 363 | + args.pid_file, |
| 364 | + ), |
| 365 | + ) |
358 | 366 |
|
359 | 367 | args.proxy_py_data_dir = DEFAULT_DATA_DIRECTORY_PATH |
360 | 368 | os.makedirs(args.proxy_py_data_dir, exist_ok=True) |
|
0 commit comments