-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make max number of simultaneous processes configurable
That limit has always existed but was implicit and undocumented. It is caused by the fact that every running process will block one worker thread from the ThreadPoolExecutor (passed to run_in_executor()). As we used the default executor, that limit could vary between python versions (32 on py37 but only 8 on py38). We now use our own ThreadPoolExecutor instead of the loop's default one. That way we can make the max number of processes configurable and avoid interfering with other code that uses the default executor.
- Loading branch information
Showing
7 changed files
with
89 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
# Number of seconds given to a child to reach the EXECUTING state before we yield in | ||
# open_in_process(). | ||
# Default number of seconds given to a child to reach the EXECUTING state before we yield in | ||
# open_in_process(). Can be overwritten by the ASYNCIO_RUN_IN_PROCESS_STARTUP_TIMEOUT | ||
# environment variable. | ||
STARTUP_TIMEOUT_SECONDS = 5 | ||
|
||
# The number of seconds that are given to a child process to exit after the | ||
# parent process gets a KeyboardInterrupt/SIGINT-signal and sends a `SIGINT` to | ||
# the child process. | ||
SIGINT_TIMEOUT_SECONDS = 2 | ||
|
||
|
||
# The number of seconds that are givent to a child process to exit after the | ||
# parent process gets an `asyncio.CancelledError` which results in sending a | ||
# `SIGTERM` to the child process. | ||
SIGTERM_TIMEOUT_SECONDS = 2 | ||
|
||
# Default maximum number of process that can be running at the same time. Can be overwritten via | ||
# the ASYNCIO_RUN_IN_PROCESS_MAX_PROCS environment variable. | ||
MAX_PROCESSES = 16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters