diff options
author | Albert Xu <thealbertxu@gmail.com> | 2021-09-10 12:42:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 19:42:57 +0300 |
commit | 8f3aaabf2db7f35556ee2bcf0d8e0af0695ab6a8 (patch) | |
tree | 19d3982ace4139cc72d21b7d72df528d94562ba9 | |
parent | 5eee36af6ba87706ea9b19a2ea640e1de8f5b8d6 (diff) | |
download | apscheduler-8f3aaabf2db7f35556ee2bcf0d8e0af0695ab6a8.tar.gz |
Exposed kwargs of underlying ThreadPool and ProcessPool executors (#546)
-rw-r--r-- | apscheduler/executors/pool.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/apscheduler/executors/pool.py b/apscheduler/executors/pool.py index b3a4caf..c85896e 100644 --- a/apscheduler/executors/pool.py +++ b/apscheduler/executors/pool.py @@ -44,10 +44,13 @@ class ThreadPoolExecutor(BasePoolExecutor): Plugin alias: ``threadpool`` :param max_workers: the maximum number of spawned threads. + :param pool_kwargs: dict of keyword arguments to pass to the underlying + ThreadPoolExecutor constructor """ - def __init__(self, max_workers=10): - pool = concurrent.futures.ThreadPoolExecutor(int(max_workers)) + def __init__(self, max_workers=10, pool_kwargs=None): + pool_kwargs = pool_kwargs or {} + pool = concurrent.futures.ThreadPoolExecutor(int(max_workers), **pool_kwargs) super(ThreadPoolExecutor, self).__init__(pool) @@ -58,8 +61,11 @@ class ProcessPoolExecutor(BasePoolExecutor): Plugin alias: ``processpool`` :param max_workers: the maximum number of spawned processes. + :param pool_kwargs: dict of keyword arguments to pass to the underlying + ProcessPoolExecutor constructor """ - def __init__(self, max_workers=10): - pool = concurrent.futures.ProcessPoolExecutor(int(max_workers)) + def __init__(self, max_workers=10, pool_kwargs=None): + pool_kwargs = pool_kwargs or {} + pool = concurrent.futures.ProcessPoolExecutor(int(max_workers), **pool_kwargs) super(ProcessPoolExecutor, self).__init__(pool) |