Base executors: thread_pool
, process_pool
, sync
¶
concurrent.futures¶
A few convenience methods are provided for the creation of
concurrent.futures
executors. The executors produced by these methods
include the more_executors.Executors
with_* methods for
Composing executors.
- classmethod Executors.thread_pool(*args, **kwargs)¶
Create a thread pool executor.
- Returns
a new executor, initialized with the given arguments
- Return type
- classmethod Executors.process_pool(*args, **kwargs)¶
Create a process pool executor.
- Returns
a new executor, initialized with the given arguments
- Return type
Sync¶
SyncExecutor is a base executor which invokes any submitted callables immediately in the calling thread.
- class more_executors.SyncExecutor(logger=None, name='default')¶
An executor which immediately invokes all submitted callables.
- Parameters
Changed in version 2.7.0: Introduced
name
.- submit(fn, *args, **kwargs)¶
Immediately invokes fn(*args, **kwargs) and returns a future with the result (or exception).
- classmethod Executors.sync(logger=None)¶
Creates a new synchronous executor.
- Returns
a new synchronous executor
- Return type
Submitted functions will be immediately invoked on the calling thread.