qml.concurrency.executors.native.conc_futures.ProcPoolExec¶
- class ProcPoolExec(max_workers=None, persist=False, **kwargs)[source]¶
Bases:
PyNativeExec
concurrent.futures.ProcessPoolExecutor class executor.
This executor wraps Python standard library concurrent.futures.ProcessPoolExecutor interface, and provides support for execution using multiple processes.
Note
All calls to the executor are synchronous, and do not currently support the use of futures as a return object.
- Parameters:
max_workers – the maximum number of concurrent units (processes) to use
persist – allow the executor backend to persist between executions. True avoids potentially costly set-up and tear-down, where supported. Explicit calls to
shutdown
will set this to False.**kwargs – Keyword arguments to pass-through to the executor backend.
Attributes
Indicates whether the executor will maintain its configured state between calls.
The size of the worker pool for the given executor.
- persist¶
Indicates whether the executor will maintain its configured state between calls.
- size¶
The size of the worker pool for the given executor.
Methods
map
(fn, *args, **kwargs)Single iterable map for batching execution of fn over data entries.
shutdown
()Shutdown the executor backend, if valid.
starmap
(fn, args, **kwargs)Single iterable map for batching execution of fn over data entries, with each entry being a tuple of arguments to fn.
submit
(fn, *args, **kwargs)Single function submission for remote execution with provided args.
- map(fn, *args, **kwargs)¶
Single iterable map for batching execution of fn over data entries. Length of every entry in
*args
must be consistent. kwargs are assumed as broadcastable to each function call.
- shutdown()¶
Shutdown the executor backend, if valid.
- starmap(fn, args, **kwargs)¶
Single iterable map for batching execution of fn over data entries, with each entry being a tuple of arguments to fn.
- submit(fn, *args, **kwargs)¶
Single function submission for remote execution with provided args.